Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition manually saving twice in a row deletes remote file #535

Open
1 task
dskzz opened this issue Jan 24, 2025 · 0 comments
Open
1 task

Race condition manually saving twice in a row deletes remote file #535

dskzz opened this issue Jan 24, 2025 · 0 comments

Comments

@dskzz
Copy link

dskzz commented Jan 24, 2025

Do you read the FAQ?

Describe the bug
Got in the habit a while ago of tapping Ctrl keyboard shortcuts twice, just to makes sure it happens. So if I double tap Ctrl-S on an open Local Remote file, it will properly upload the first time but the second time the remote file will dissappear and flash me an error. I can obviously save it again or Right click, upload, for the file to be restored...and if I save, wait a second, save again, it's fine.

Wouldnt be a big deal except for the deletion. I can see where someone might accidently double tap and delete the file, close out the app and lose something forever. Or worse, accidently double save and then go and tear your hair out why all your CSS just reset or your JS isn't working and go through a whole chain of WTF.

I suspect it is deleting the remote file waiting for the upload to complete but then is clobbered by the new save which then fails to see the remote file and throws an error.

Also if you do this you'll get spammed the No such file warning.

To Reproduce
Steps to reproduce the behavior:

  1. Open file for local editing
  2. Ctrl-S, Ctrl-S twice in a row.
  3. See error

Expected behavior
Save once, do not delete remote file.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • VSCode Version: 1.96.0
  • Extension Version
    1.16.3

Extension Logs from Startup - required
[01-24 09:54:12] [debug] register command "Cancel All Transfer" from "./commandCancelAllTransfer.ts"
[01-24 09:54:12] [debug] register command "Config" from "./commandConfig.ts"
[01-24 09:54:12] [debug] register command "List Active Folder" from "./commandListActiveFolder.ts"
[01-24 09:54:12] [debug] register command "Open Ssh Connection" from "./commandOpenSshConnection.ts"
[01-24 09:54:12] [debug] register command "Set Profile" from "./commandSetProfile.ts"
[01-24 09:54:12] [debug] register command "Toggle Output Panel" from "./commandToggleOutputPanel.ts"
[01-24 09:54:12] [debug] register command "Upload Changed Files" from "./commandUploadChangedFiles.ts"
[01-24 09:54:12] [debug] register command "Create File" from "./fileCommandCreateFile.ts"
[01-24 09:54:12] [debug] register command "Create Folder" from "./fileCommandCreateFolder.ts"
[01-24 09:54:12] [debug] register command "Delete Remote" from "./fileCommandDeleteRemote.ts"
[01-24 09:54:12] [debug] register command "Diff" from "./fileCommandDiff.ts"
[01-24 09:54:12] [debug] register command "Diff Active File" from "./fileCommandDiffActiveFile.ts"
[01-24 09:54:12] [debug] register command "Download" from "./fileCommandDownload.ts"
[01-24 09:54:12] [debug] register command "Download Active File" from "./fileCommandDownloadActiveFile.ts"
[01-24 09:54:12] [debug] register command "Download Active Folder" from "./fileCommandDownloadActiveFolder.ts"
[01-24 09:54:12] [debug] register command "Download File" from "./fileCommandDownloadFile.ts"
[01-24 09:54:12] [debug] register command "Download Folder" from "./fileCommandDownloadFolder.ts"
[01-24 09:54:12] [debug] register command "Download Force" from "./fileCommandDownloadForce.ts"
[01-24 09:54:12] [debug] register command "Download Project" from "./fileCommandDownloadProject.ts"
[01-24 09:54:12] [debug] register command "Edit In Local" from "./fileCommandEditInLocal.ts"
[01-24 09:54:12] [debug] register command "List" from "./fileCommandList.ts"
[01-24 09:54:12] [debug] register command "List All" from "./fileCommandListAll.ts"
[01-24 09:54:12] [debug] register command "Reveal In Explorer" from "./fileCommandRevealInExplorer.ts"
[01-24 09:54:12] [debug] register command "Reveal In Remote Explorer" from "./fileCommandRevealInRemoteExplorer.ts"
[01-24 09:54:12] [debug] register command "Sync Both Directions" from "./fileCommandSyncBothDirections.ts"
[01-24 09:54:12] [debug] register command "Sync Local To Remote" from "./fileCommandSyncLocalToRemote.ts"
[01-24 09:54:12] [debug] register command "Sync Remote To Local" from "./fileCommandSyncRemoteToLocal.ts"
[01-24 09:54:12] [debug] register command "Upload" from "./fileCommandUpload.ts"
[01-24 09:54:12] [debug] register command "Upload Active File" from "./fileCommandUploadActiveFile.ts"
[01-24 09:54:12] [debug] register command "Upload Active Folder" from "./fileCommandUploadActiveFolder.ts"
[01-24 09:54:12] [debug] register command "Upload File" from "./fileCommandUploadFile.ts"
[01-24 09:54:12] [debug] register command "Upload Folder" from "./fileCommandUploadFolder.ts"
[01-24 09:54:12] [debug] register command "Upload Force" from "./fileCommandUploadForce.ts"
[01-24 09:54:12] [debug] register command "Upload Project" from "./fileCommandUploadProject.ts"
[01-24 09:54:12] [debug] register command "Upload Active File To All Profiles" from "./fileMultiCommandUploadActiveFileToAllProfiles.ts"
[01-24 09:54:12] [debug] register command "Upload Active Folder To All Profiles" from "./fileMultiCommandUploadActiveFolderToAllProfiles.ts"
[01-24 09:54:12] [debug] register command "Upload File To All Profiles" from "./fileMultiCommandUploadFileToAllProfiles.ts"
[01-24 09:54:12] [debug] register command "Upload Folder To All Profiles" from "./fileMultiCommandUploadFolderToAllProfiles.ts"
[01-24 09:54:12] [debug] register command "Upload Force To All Profiles" from "./fileMultiCommandUploadForceToAllProfiles.ts"
[01-24 09:54:12] [debug] register command "Upload Project To All Profiles" from "./fileMultiCommandUploadProjectToAllProfiles.ts"
[01-24 09:54:12] [debug] register command "Upload To All Profiles" from "./fileMultiCommandUploadToAllProfiles.ts"
[01-24 09:54:12] [info] config at g:\xxxxxxxxxxxxxx\ {"remotePath":"/home/WVUwGyu3kiXYnp/html/wp-content","uploadOnSave":true,"useTempFile":true,"openSsh":false,"downloadOnOpen":false,"ignore":[".vscode",".git",".DS_Store",".github/",".ci"],"concurrency":4,"protocol":"sftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"remoteExplorer":{"filesExclude":[".git",".vscode",".github"]},"name":"xxxxxxxxxxxxxxxx","host":"xxxxxxxxxxxxxxxx","port":xxx,"username":"","context":"./","watcher":{"files":"statics//","autoUpload":true,"autoDelete":false},"password":"*****","profiles":{}}

[01-24 09:51:15] [info] [file-save] G:\xxxxxxxxxxxxxxx\plugins\custom-media-gallery\custom-media-gallery.php
[01-24 09:51:15] [info] [file-save] G:\xxxxxxxxxxx\plugins\custom-media-gallery\custom-media-gallery.php
[01-24 09:51:16] [info] uploading temp file: /home/xxxxxxxxxx/html/wp-content/plugins/custom-media-gallery/custom-media-gallery.php.new
[01-24 09:51:16] [info] uploading temp file: /home/xxxxxxxxxxxx/html/wp-content/plugins/custom-media-gallery/custom-media-gallery.php.new
[01-24 09:51:16] [info] moving from: /home/xxxxxxxxxxxxx/html/wp-content/plugins/custom-media-gallery/custom-media-gallery.php.new to: /home/WVUwGyu3kiXYnp/html/wp-content/plugins/custom-media-gallery/custom-media-gallery.php
[01-24 09:51:16] [info] moving from: /home/xxxxxxxxxxxxxx/html/wp-content/plugins/custom-media-gallery/custom-media-gallery.php.new to: /home/xxxxxxxxxxxxxx/html/wp-content/plugins/custom-media-gallery/custom-media-gallery.php
[01-24 09:51:17] [info] local ➞ remote g:\xxxxxxxxxxxx\plugins\custom-media-gallery\custom-media-gallery.php
[01-24 09:51:17] [error] Error: No such file
at 101 (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\protocol\SFTP.js:2854:19)
at SFTP.push (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\protocol\SFTP.js:278:11)
at CHANNEL_DATA (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\client.js:587:23)
at 94 (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\protocol\handlers.misc.js:930:16)
at Protocol.onPayload (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\protocol\Protocol.js:2052:10)
at AESGCMDecipherNative.decrypt (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\protocol\crypto.js:987:26)
at Protocol.parsePacket [as _parse] (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\protocol\Protocol.js:2021:25)
at Protocol.parse (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\protocol\Protocol.js:306:16)
at Socket. (c:\Users\dmzBC.vscode\extensions\natizyskunk.sftp-1.16.3\node_modules\ssh2\lib\client.js:775:21)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Socket.Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:191:23) when local ➞ remote g:\xxxxxxxxxxxxx\plugins\custom-media-gallery\custom-media-gallery.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant