jmanuel1 / todoer

Automatically add an email to your local todo.txt when you star it.
MIT License
4 stars 1 forks source link

Race when email threads are starred quickly leads to file corruption #1

Open jmanuel1 opened 4 years ago

jmanuel1 commented 4 years ago

In the unstable branch:

2019-11-09 Security alert for your linked Google Account email/id:t_caNytfAQbvLKagENsatLwdXMQ3EEuGULe3fh1KF59 @emailmail
2019-11-09 Security alert for your linked Google Account email/id:t_caNytfAQbvLKagENsatLwdXMQ3EEuGULe3fh1KF59 @email

Note the duplicated id and the corrupted @emailmail context. I think this is because there are multiple concurrent reads and writes to the file when emails are (un)starred in quick succession. Perhaps all the functions manipulating the file should act transactionally with respect to the file.

jmanuel1 commented 4 years ago

I was able to reproduce the corrupted contexts by unstarring nine emails at once though multi-selection, followed by right-clicking and selecting "Remove Stars." I have yet to reproduce the todo-duplication.