mpcjanssen / simpletask-android

GNU General Public License v3.0
543 stars 125 forks source link

Dropbox: Adding items via intent will sometimes overwrite todo.txt with empty file #266

Closed shayneholmes closed 8 years ago

shayneholmes commented 9 years ago

I have a Tasker task that adds items to my todo.txt programmatically via the background task intent. Since recently (the new Dropbox core sync API?), this action will occasionally overwrite my todo.txt with an empty (technically 2-byte, I'm guessing just the the utf-8 bom) file. I can get it back through the Dropbox deleted versions, but this would otherwise be a data loss issue.

  1. Create a file with "A"
  2. Call the background add task intent with text "B"

Expected: Todo.txt has "A/B"

Actual: Todo.txt is empty. The last version on Dropbox is "A"; Dropbox never sees the "B" item.

I've installed the latest debug version (5.5.7); I've got a logcat that I took just after this occurred again, which I have pasted here: https://gist.github.com/shayneholmes/e2ef30340f92b6feb5af

mpcjanssen commented 9 years ago

When does this happen. Does it always happen? Or does it only happen of Simpletask was not running already?

mpcjanssen commented 9 years ago

Logcat indicates that Simpletask is not running in the background at this point yet.

mpcjanssen commented 9 years ago

This issue us caused by the fact that an item is being added while the todolist is still loading in the background. It's easy to reproduce by killing simpletask and doing a note to self.

mpcjanssen commented 9 years ago

Only way to prevent race conditions like this is to queue changes on the todolist. I am working on a queueing mechanism for this, but that takes some time. For now add a widget somewhere to ensure simpletask is running in the background.

mpcjanssen commented 9 years ago

@shayneholmes could you please retest with the version at http://mpcjanssen.nl/files/simpletask/latest ?

shayneholmes commented 9 years ago

Tested and verified it worked right once, will check over the next day for assurance. Thanks! On Jul 8, 2015 9:24 AM, "Mark Janssen" notifications@github.com wrote:

@shayneholmes https://github.com/shayneholmes could you please retest with the version at http://mpcjanssen.nl/files/simpletask/latest ?

— Reply to this email directly or view it on GitHub https://github.com/mpcjanssen/simpletask-android/issues/266#issuecomment-119649192 .

shayneholmes commented 9 years ago

With about 24 hours on this change, I haven't been able to reproduce the bug. I also checked it out with the "kill-first" step you outlined, both online and off-, and no problems. I'll go ahead and close this.

shayneholmes commented 9 years ago

Okay, so I've seen this crop up once again; I will watch it over the next few days' usage and post back here if I see anything untoward.

kai11 commented 8 years ago

I had problem with urls from "share" menu today as well and my todo.txt is empty (in cloudless version it's problematic, dropbox keeps old versions). @mpcjanssen , can you add versioning? E.g. move todo.txt to todo-{timestamp}.txt before any change will save A LOT of time if this issue occurs in the future.

mpcjanssen commented 8 years ago

Old versions are stored in an internal sqlite database. For now you can share the whole db and extract with a salute editor. Next release will have a built in history viewer. In the meantime I will keep investigating this issue.

mpcjanssen commented 8 years ago

@kai11 and @shayneholmes can you share your log files with me when this happens (preferably after updating to the latest version from https://mpcjanssen.nl/files/simpletask/latest) I have no clue why this is happening.

mpcjanssen commented 8 years ago

I was able to reproduce this issue on my device. So I can look into a fix.

mpcjanssen commented 8 years ago

Of course as soon as I have said I can reproduce it and have added logging, it doesn't occur anymore.

shayneholmes commented 8 years ago

I've got the latest debug (22 July) installed, will keep an eye out for this again.

mpcjanssen commented 8 years ago

@shayneholmes the current playstore version is actually newer.

shayneholmes commented 8 years ago

Thanks for the pointer, I've got that one now. I'll keep using it on Dropbox and will be background adding about daily; I'll update here and mail logs if I see the overwrite.

mpcjanssen commented 8 years ago

I am currently running a tasker action in the background as well. Haven't seen any issues.

On Fri, Jul 24, 2015, 18:23 Shayne Holmes notifications@github.com wrote:

Thanks for the pointer, I've got that one now. I'll keep using it on Dropbox and will be background adding about daily; I'll update here and mail logs if I see the overwrite.

— Reply to this email directly or view it on GitHub https://github.com/mpcjanssen/simpletask-android/issues/266#issuecomment-124572259 .

mpcjanssen commented 8 years ago

With the queuing I am pretty convinced this is fixed. Please re-open if this re-occurs.

mimmori commented 8 years ago

@shayneholmes Could you share your tasker Task/Profile?

I am going to work to add more automation in todo management (add task by mail / whatsapp, show task for current location / ... ) and your work could be a good starting point.

Thanks. Domenico