esqlite: Race condition: Occasional VM crash due to dangling pointer to sqlite3_stmt struct
As mentioned in my final comment on #33, I am still seeing occasional VM crashes, though with new symptoms. The crashes I am seeing now are always segfaults (no assertion failures as in #33), and with a build instrumented to print stack traces, the crashes are always in sqlite3_* API functions.
I believe the following sequence of operations is happening:
- (scheduler thread) Create DB.
- (scheduler thread) Prepare a statement.
- (scheduler thread) Request information about that prepared statement (i.e.
column_names). Queues request to command processing thread. - (scheduler thread) Thread gets killed.
- (scheduler thread) Garbage collects statement reference, thus triggering a call to
sqlite3_finalize. - (command processing thread) Processes the request queued at step 3, thus triggering a call to
sqlite3_column_nameusing a now-defunct pointer tosqlite3_stmt. crash
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (18 by maintainers)
Thank you too. And Ecto2’s test routines.
This is probably the first stable release of esqlite.