cpbotha / nvpy

Simplenote syncing note-taking application, inspired by Notational Velocity and ResophNotes, but uglier and cross-platformerer.
Other
849 stars 114 forks source link

Racecondition in housekeeper and workers (save and sync) #167

Closed yuuki0xff closed 5 years ago

yuuki0xff commented 5 years ago
(Pdb) bt
  /home/yuuki/repo/github.com/cpbotha/nvpy/nvpy/debug.py(14)wrapper()
-> return fn(*args, **kwargs)
  /home/yuuki/repo/github.com/cpbotha/nvpy/nvpy/nvpy.py(591)observer_view_keep_house()
-> nsaved = self.notes_db.save_threaded()
  /home/yuuki/repo/github.com/cpbotha/nvpy/nvpy/notes_db.py(570)save_threaded()
-> if Note(n).need_save:
> /home/yuuki/repo/github.com/cpbotha/nvpy/nvpy/notes_db.py(1028)need_save()
-> savedate = float(self['savedate'])
(Pdb) p sorted(self.keys())
[u'content', u'createdate', u'creationDate', u'deleted', u'key', u'modificationDate', u'modifydate', u'publishURL', u'shareURL', 'syncdate', u'systemTags', u'systemtags', u'tags', u'version']
(Pdb) up
> /home/yuuki/repo/github.com/cpbotha/nvpy/nvpy/notes_db.py(570)save_threaded()
-> if Note(n).need_save:
(Pdb) p sorted(n.keys())
[u'content', u'createdate', u'creationDate', u'deleted', u'key', u'modificationDate', u'modifydate', u'publishURL', 'savedate', u'shareURL', 'syncdate', u'systemTags', u'systemtags', u'tags', u'version']
(Pdb) up
(Pdb) up
(Pdb) p threading.current_thread()
<_MainThread(MainThread, started 140714001274176)>
(Pdb) pp {t.name: t._Thread__target for t in threading.enumerate()}
{'MainThread': None,
 'Thread-1': <function worker_save at 0x7ffa855ff758>,
 'Thread-2': <function worker_sync at 0x7ffa855ff7d0>}