-
Notifications
You must be signed in to change notification settings - Fork 669
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
local state db not kept consistent on client quit ("zombie" file if client interrupted) #1738
Comments
What I believe happenned: Next sync, the files are on the server. They are seen as new because we don't have their etag in the database. So we have to download them back. We could detect that an upload was finished but not yet writen to the database, but then we would still have th eproblem that without the etag, we don't know if the file has been changed on the server or not. And we don't want to just delete those files in doubt. I would not say it is a database inconsistency. I think we can't fix this bug and don't want to do it. |
I just checked again the headers which are sent in this test scenario. The server DOES provide an etag in the PUT response header (I see it for the files which are uploaded). It appears that when I "Quit" with the button you don't wait for the termination of ongoing requests to be able to save the etag. Hence subsequently you don' know if the transfer completed or not. I would certainly not expect such a behaviour with a normal "Quit". I would normally expect that a user may wait a little bit to finish the ongoing transfers or force quit. I could possibly agree that if I killed the process externally one may expect some glitches. Even then I think it should be possible to find out if the file made it to the server or not an a subsequent restart (just stat/propfind it -- the server should behave in a transactional way - so it would either completely put the file or not at all if the data transfer was interrupted). Of course, in doubt, better not to delete files, but here at least for the normal "Quit" we may just avoid the problem altogether if we allow the transfers to terminate. For 1.6 the problem is more pronounced because it concerns ALL files uploaded in parallel. What do you think? |
Note to self: For small files, the uploadinfo table is not used. Only chunks are written to the uploadinfo table. |
Right, quit cancels any ongoing transfers. It is true we could wait a couple of seconds. for upload for an answer from the server. |
Yes, so on quit we will wait for either having all currently running jobs finished or for a couple of seconds, and than quit the client. But I'll move that to a later milestone as it is a too large change for 1.6.0, compared to the problems it can cause. |
We will not fix this issue:
Solving this bug on the other hand may cause data loss in some other corner cases. |
If you quit the client while it is uploading the file the local state db for that file is not updated. This has wierd side effect on a client restart. For example, if you delete this file locally (or a directory containing it) a "zombie" file will be downloaded from the server (a file will reappear magically back to life on your local folder).
See logs below.
Steps to reproduce:
for i in {01..99}; do
echo "this is test $i" >> NEW_DIR/test-$i.txt;
done
Quit the client while uploading. Delete NEW_DIR altogether. Restart the client.
For 1.5.3 the last file will become a "zombie".
For 1.6.0-beta2 (today's git master actually) the whole lot of files will come back to life. So the local state DB consistency on exit in this version is even more of a problem.
If I read the schema correctly, the uploadinfo table could be used to mark the beginning of the file transfer, and then the entry being removed after the file upload was successful and an entry in metadata table created. There is still a small chance that the file is successfully uploaded but the client process gets killed before you create the entry in the metadata table but this should probably provide you already with enough state information to react properly on the next client restart (propagate deletion if the local file has been deleted and has an entry in uploadinfo table).
Here are the logs - client quit while uploading test-15.txt:
The localstate db:
The text was updated successfully, but these errors were encountered: