You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Will Glass-Husain (JIRA)" <ji...@apache.org> on 2010/11/20 05:24:16 UTC
[jira] Created: (SSHD-97) Uploading file via SFTP leaves file in
locked state on Windows
Uploading file via SFTP leaves file in locked state on Windows
--------------------------------------------------------------
Key: SSHD-97
URL: https://issues.apache.org/jira/browse/SSHD-97
Project: MINA SSHD
Issue Type: Bug
Affects Versions: 0.5.0
Environment: JDK 1.6.0_18 (32bit) running on Win 7 (64 bit). I've a fairly out-of-the-box Mina SSHD / sftp config. I'm serving from my local Windows machine.
Reporter: Will Glass-Husain
Uploading a file via SFTP leaves the file in a locked state. Specifically, when I upload a file using sftpd, the file is locked in windows, even after the upload is complete.
I verified this by using Yourkit Profiler (see attached screenshots). There are two writes to the file
* first: NativeSshFile.truncate() erases the old file. This is what fails to clean up
* second: NativeSshFile.createOutputStream(). This is properly closed after use.
The fix is simple. In the truncate() method, close the RandomAccessFile after it is created. See attached patch.
I tested this by putting the truncate method in a subclass of NativeSshFile and it solved the problem.
After applying the patch to the Mina SSHD source code, I ran "mvn test" which passed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (SSHD-97) Uploading file via SFTP leaves file in
locked state on Windows
Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Will Glass-Husain updated SSHD-97:
----------------------------------
Attachment: patch.txt
> Uploading file via SFTP leaves file in locked state on Windows
> --------------------------------------------------------------
>
> Key: SSHD-97
> URL: https://issues.apache.org/jira/browse/SSHD-97
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: JDK 1.6.0_18 (32bit) running on Win 7 (64 bit). I've a fairly out-of-the-box Mina SSHD / sftp config. I'm serving from my local Windows machine.
> Reporter: Will Glass-Husain
> Attachments: notclosed.png, patch.txt, stacktrace.png
>
>
> Uploading a file via SFTP leaves the file in a locked state. Specifically, when I upload a file using sftpd, the file is locked in windows, even after the upload is complete.
> I verified this by using Yourkit Profiler (see attached screenshots). There are two writes to the file
> * first: NativeSshFile.truncate() erases the old file. This is what fails to clean up
> * second: NativeSshFile.createOutputStream(). This is properly closed after use.
> The fix is simple. In the truncate() method, close the RandomAccessFile after it is created. See attached patch.
> I tested this by putting the truncate method in a subclass of NativeSshFile and it solved the problem.
> After applying the patch to the Mina SSHD source code, I ran "mvn test" which passed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (SSHD-97) Uploading file via SFTP leaves file in
locked state on Windows
Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Will Glass-Husain updated SSHD-97:
----------------------------------
Attachment: stacktrace.png
notclosed.png
> Uploading file via SFTP leaves file in locked state on Windows
> --------------------------------------------------------------
>
> Key: SSHD-97
> URL: https://issues.apache.org/jira/browse/SSHD-97
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: JDK 1.6.0_18 (32bit) running on Win 7 (64 bit). I've a fairly out-of-the-box Mina SSHD / sftp config. I'm serving from my local Windows machine.
> Reporter: Will Glass-Husain
> Attachments: notclosed.png, patch.txt, stacktrace.png
>
>
> Uploading a file via SFTP leaves the file in a locked state. Specifically, when I upload a file using sftpd, the file is locked in windows, even after the upload is complete.
> I verified this by using Yourkit Profiler (see attached screenshots). There are two writes to the file
> * first: NativeSshFile.truncate() erases the old file. This is what fails to clean up
> * second: NativeSshFile.createOutputStream(). This is properly closed after use.
> The fix is simple. In the truncate() method, close the RandomAccessFile after it is created. See attached patch.
> I tested this by putting the truncate method in a subclass of NativeSshFile and it solved the problem.
> After applying the patch to the Mina SSHD source code, I ran "mvn test" which passed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (SSHD-97) Uploading file via SFTP leaves file in
locked state on Windows
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet resolved SSHD-97.
---------------------------------
Resolution: Fixed
Fix Version/s: 0.6.0
Assignee: Guillaume Nodet
Thxnk a ton for the patch!
Committing to https://svn.apache.org/repos/asf/mina/sshd/trunk ...
M sshd-core/src/main/java/org/apache/sshd/server/filesystem/NativeSshFile.java
Committed r1039429
> Uploading file via SFTP leaves file in locked state on Windows
> --------------------------------------------------------------
>
> Key: SSHD-97
> URL: https://issues.apache.org/jira/browse/SSHD-97
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: JDK 1.6.0_18 (32bit) running on Win 7 (64 bit). I've a fairly out-of-the-box Mina SSHD / sftp config. I'm serving from my local Windows machine.
> Reporter: Will Glass-Husain
> Assignee: Guillaume Nodet
> Fix For: 0.6.0
>
> Attachments: notclosed.png, patch.txt, stacktrace.png
>
>
> Uploading a file via SFTP leaves the file in a locked state. Specifically, when I upload a file using sftpd, the file is locked in windows, even after the upload is complete.
> I verified this by using Yourkit Profiler (see attached screenshots). There are two writes to the file
> * first: NativeSshFile.truncate() erases the old file. This is what fails to clean up
> * second: NativeSshFile.createOutputStream(). This is properly closed after use.
> The fix is simple. In the truncate() method, close the RandomAccessFile after it is created. See attached patch.
> I tested this by putting the truncate method in a subclass of NativeSshFile and it solved the problem.
> After applying the patch to the Mina SSHD source code, I ran "mvn test" which passed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SSHD-97) Uploading file via SFTP leaves file in
locked state on Windows
Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936037#action_12936037 ]
Will Glass-Husain commented on SSHD-97:
---------------------------------------
As a side note, before this patch is applied "mvn test" fails on Windows. (i.e. sftpTest tries to delete a file but can't). After this patch is applied the tests pass.
> Uploading file via SFTP leaves file in locked state on Windows
> --------------------------------------------------------------
>
> Key: SSHD-97
> URL: https://issues.apache.org/jira/browse/SSHD-97
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: JDK 1.6.0_18 (32bit) running on Win 7 (64 bit). I've a fairly out-of-the-box Mina SSHD / sftp config. I'm serving from my local Windows machine.
> Reporter: Will Glass-Husain
> Attachments: notclosed.png, patch.txt, stacktrace.png
>
>
> Uploading a file via SFTP leaves the file in a locked state. Specifically, when I upload a file using sftpd, the file is locked in windows, even after the upload is complete.
> I verified this by using Yourkit Profiler (see attached screenshots). There are two writes to the file
> * first: NativeSshFile.truncate() erases the old file. This is what fails to clean up
> * second: NativeSshFile.createOutputStream(). This is properly closed after use.
> The fix is simple. In the truncate() method, close the RandomAccessFile after it is created. See attached patch.
> I tested this by putting the truncate method in a subclass of NativeSshFile and it solved the problem.
> After applying the patch to the Mina SSHD source code, I ran "mvn test" which passed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.