This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 258338 - Avoid "missing file" error while uploading via SFTP (rename files atomically for services availability)
Summary: Avoid "missing file" error while uploading via SFTP (rename files atomically ...
Status: NEW
Alias: None
Product: contrib
Classification: Unclassified
Component: RemoteFS (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: remotefs@contrib
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-12 14:13 UTC by kripper
Modified: 2016-03-12 14:13 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kripper 2016-03-12 14:13:47 UTC
When uploading files via SFTP (using a temp file and not "direct upload"), Netbeans 1) uploads the file with a ".new" extension, 2) renames the destination file adding an ".old" extension and then 3) renames the new uploaded file to replace the original destination file. 4) Finally, the .old file is removed.

Between step 2) and 3), the file is shortly unavailable on the server causing services to fail.

To fix this issue, steps 2) and 3) have to be done atomically.

In case there is no way to run commands 2) and 3) at once, another option is to copy the .new file overwriting the original destination file (server side).

This fix will not only avoid errors while updating a production site, but also enhance working on remote sites since step 2, 3 and 4 would be done in one single step without compromising services availability.