"Endurance" setting does not prevent "atomic write" problem
Description: Some of our PHP files are large, and take up to 5 seconds to upload to our web server. If someone visits the page during the upload, they retrieve only part of the file, as SFTP is writing it.
I understand that this used to be a known problem, and I see that the "Endurance" feature has now been added so that uploaded files are copied to a temporary file first, and only on completion of the upload are they copied/renamed, thereby reducing the time window of a partial read to almost zero.
However, if I set Endurance ON (all files) and request the file using HTTP during the upload, I still get a partial file read.
Settings: WinSCP 4.1.8, SFTP-3, Commander View (double-click and drag/drop both fail))
Any help would be very welcome.
WinSCP log:
Copying 1 files/directories to remote directory "/var/www/vhosts/mydomain.com/httpdocs/TEST/" PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: Y (102400); CalcS: Yes; Mask: *.* TM: M; ClAr: No; CPS: 0; ExclM(No): AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml File: "C:\www\mydomain\src\tableinfo.php" Copying "C:\www\mydomain\src\tableinfo.php" to remote directory started. Ascii transfer mode selected. Opening remote file. Type: SSH_FXP_OPEN, Size: 82, Number: 34563 Type: SSH_FXP_STATUS, Size: 24, Number: 34308 Discarding reserved response Type: SSH_FXP_HANDLE, Size: 13, Number: 34563 Type: SSH_FXP_WRITE, Size: 4071, Number: 35078 10 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets. Type: SSH_FXP_CLOSE, Size: 13, Number: 36868 Type: SSH_FXP_SETSTAT, Size: 78, Number: 34825 Type: SSH_FXP_STATUS, Size: 24, Number: 36102 Type: SSH_FXP_STATUS, Size: 24, Number: 36358 Type: SSH_FXP_STATUS, Size: 24, Number: 36614 Type: SSH_FXP_STATUS, Size: 24, Number: 36868 Status/error code: 0 Type: SSH_FXP_STATUS, Size: 24, Number: 34825 Status/error code: 0 Listing directory "/var/www/vhosts/mydomain.com/httpdocs/TEST". Type: SSH_FXP_OPENDIR, Size: 52, Number: 37131 Type: SSH_FXP_HANDLE, Size: 13, Number: 37131 Type: SSH_FXP_READDIR, Size: 13, Number: 37388 Type: SSH_FXP_NAME, Size: 12497, Number: 37388 Type: SSH_FXP_READDIR, Size: 13, Number: 37644 Type: SSH_FXP_NAME, Size: 12529, Number: 37644 Type: SSH_FXP_READDIR, Size: 13, Number: 37900 Type: SSH_FXP_NAME, Size: 12542, Number: 37900 Type: SSH_FXP_READDIR, Size: 13, Number: 38156 Type: SSH_FXP_NAME, Size: 12649, Number: 38156 Type: SSH_FXP_READDIR, Size: 13, Number: 38412 Type: SSH_FXP_NAME, Size: 12675, Number: 38412 Type: SSH_FXP_READDIR, Size: 13, Number: 38668 Type: SSH_FXP_NAME, Size: 12479, Number: 38668 Type: SSH_FXP_READDIR, Size: 13, Number: 38924 Type: SSH_FXP_NAME, Size: 12612, Number: 38924 Type: SSH_FXP_READDIR, Size: 13, Number: 39180 Type: SSH_FXP_NAME, Size: 13105, Number: 39180 Type: SSH_FXP_READDIR, Size: 13, Number: 39436 Type: SSH_FXP_NAME, Size: 12754, Number: 39436 Type: SSH_FXP_READDIR, Size: 13, Number: 39692 Type: SSH_FXP_NAME, Size: 12657, Number: 39692 Type: SSH_FXP_READDIR, Size: 13, Number: 39948 Type: SSH_FXP_NAME, Size: 12903, Number: 39948 Type: SSH_FXP_READDIR, Size: 13, Number: 40204 Type: SSH_FXP_NAME, Size: 13375, Number: 40204 Type: SSH_FXP_READDIR, Size: 13, Number: 40460 Type: SSH_FXP_NAME, Size: 6121, Number: 40460 Type: SSH_FXP_READDIR, Size: 13, Number: 40716 Type: SSH_FXP_STATUS, Size: 28, Number: 40716 Status/error code: 1 Type: SSH_FXP_CLOSE, Size: 13, Number: 40964
e.g.
-- time --> 1----------2----------3----------4----------5----------6----------7
1 = HTTP read file hello.php - OK
2 = start transfer of hello.php using SFTP-3 in WinSCP 4.1.8
3 = HTTP read file hello.php - ERROR
4 = HTTP read file hello.php - ERROR
5 = HTTP read file hello.php - ERROR
6 = finish transfer of hello.php using SFTP-3 in WinSCP 4.1.8
7 = HTTP read file hello.php - OK