Commit 96ac49c
committed
fix(sqlite3): avoid reentrant deadlock in Statement::new
sqlite3_prepare_v2 can synchronously invoke the authorizer callback,
which may call back into Connection methods (e.g. set_authorizer)
that require the same db lock. Holding db_lock across the prepare()
call caused a self-deadlock when a callback re-entered the connection.
Release the lock after sql_limit check and copy the raw handle before
calling prepare(), so FFI calls that can trigger Python re-entrancy
happen outside the lock scope.
Fixes hang in test_authorizer_concurrent_mutation_in_call1 parent d809353 commit 96ac49c
1 file changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2798 | 2798 | | |
2799 | 2799 | | |
2800 | 2800 | | |
2801 | | - | |
2802 | | - | |
2803 | | - | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
2804 | 2806 | | |
2805 | 2807 | | |
2806 | | - | |
| 2808 | + | |
2807 | 2809 | | |
2808 | 2810 | | |
2809 | 2811 | | |
| |||
0 commit comments