taskwarrior: [TW-1711] pending.data corruption involving concurrent processes
Daniel Shahaf on 2015-10-01T18:07:30Z says:
As reported on IRC some time ago:
Sep 19 00:14:37 <danielsh> Ran into db corruption with 2.4.4. Just after rebooting, spawned taskswamp instance. git logs of ~/.task show four commits. The first commit emptied pending.data. The second and third appear normal. The fourth prepended 154018 NUL bytes to line 4 of pending.data.
Sep 19 00:15:12 <danielsh> I've recovered from this by backdating the ~/.task/ git worktree, but I kept a copy of the corruption.
Sep 19 00:18:10 <danielsh> Those reports would have created a new instance of a recurring task. Each of the four commits touches both the parent task and a new child thereof. The various commits all add lines related to the recurring task to *.data, but each commit adds a different number of entries.
Sep 19 00:27:12 <danielsh> Running debian stable (jessie) if it matters.
The problem occurred again now, in identical circumstances: while ~/.config/autostart/
was being run, immediately after a reboot. This time, there are 85316 NULs prepended to line 8 of pending.data.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 3
- Comments: 15 (1 by maintainers)
Just adding my 2 cents on the matter: I use flock to ensure only one task process runs at a time. It should be available by default on many distributions. For interactive shells, an alias:
alias task='flock ~/.task task'
. For cron or other places (conky for me):flock /home/me/.task task ...
. This way you make sure you won’t corrupt your data because you ran task in your terminal at the same moment cron or conky did.Brilliant! Sort of like a mutex on the task warrior process. Perhaps this should be included into the help documentation. Now I can have auto sync again without any drawbacks.
On Thu, Nov 22, 2018, 12:58 PM Timothée Mazzucotelli < notifications@github.com> wrote:
–
may today be the best day of your life,
david parkinson founder - aroonilabs.com blog - brofist.com twitter - @brofist https://twitter.com/brofist
Absolutely this is caused by simultaneous writes. Don’t sync via cron.