meetings / gearsloth

Gearman job persistence and delayed execution system
MIT License
2 stars 0 forks source link

SQLite adapter might not lock tasks properly in the runner #66

Closed amv closed 10 years ago

amv commented 10 years ago

@kenkku mentioned that the SQLite adapter shares the database object with all of the components that run inside a single node process. This might mean that the locks grabbed by that node process might not prevent other components (within the same node process) from altering the tasks while the runner is trying to move them to the controllers.

AFAIK the SQLite system does not provide row level locking so extra care should be taken to ensure that the entire database is locked during the whole runner update cycle. With the lock capturing being seemingly "automatic" when using the database object with the node-sqlite3 library, extra care should be taken that the shared database object does not prevent the runner from actually locking the table.

I believe it might be a good idea to look into fixing this through initializing a separate adapter for each of the distinct components even if they are run within the same node process. This would also help fix #25 which has discussion about this same topic.

amv commented 10 years ago

discussed this with @Virta and it seems that due to the current runner logic, it is not needed to lock anything outside atomic sql queries.