SQLite Forum

sqlite3 library functions holding off a process flow
Login

sqlite3 library functions holding off a process flow

(1.1) Originally by Shreyas (shreyask) with edits by Richard Hipp (drh) on 2021-05-26 11:34:24 from 1.0 [source]

Hi, There is a system daemon that uses sqlite database to store data about various configurations. However, during a particular event, the daemon gets hung with this pstack,

001ffecb5cfe1858 __pread (4, 4cf895a018, 8000, 3f0000, 0, 1ffecb5cbd5240) + c
 001ffecb5c83d548 unixRead (4cf8209a50, 4cf895a018, 8000, 3f0000, 4cf895a018, 8000) + 80
 001ffecb5c878d64 readDbPage (4cf8962050, 7f, 8000, 2e0, 1, 4cf82098d8) + ec
 001ffecb5c8d0c78 getPageNormal (4cf82098d8, 7f, 1ffecb5affa908, 2, 0, 4cf8962050) + 434
 001ffecb5c87aaa8 moveToChild (4cf9fb6198, 7f, 0, 0, 4cf8211f18, 54) + 80
 001ffecb5c8d4038 sqlite3BtreeMovetoUnpacked (4cf9fb6198, 0, 1d9e48, ffffffffffffffff, 1ffecb5affaaac, 4cf89a3dd2) + 258
 001ffecb5c8d44ac sqlite3VdbeFinishMoveto (4cf9fb60d8, 3, 1ffecb5affac88, 4cf8b0da80, 3, 1) + 20
 001ffecb5c926b64 sqlite3VdbeExec (4cf8736918, 59, 59, 4cf9fb60d8, 4cf8209c58, 4cf856f808) + 8840
 001ffecb5c92adb4 sqlite3_step (4cf8736918, 4cf8209c58, 0, 1ffecb5cbd5240, 4cf8209c58, 3000) + 290
 001ffecb5d7229ac backend_stmt_exec (4cf8736918, 1ffecb5d71eb90, 1ffecb5affb030, 1ffecb5affaf70, 0, 0) + 94
 001ffecb5d722ac8 backend_tx_run (4cf9e673c0, 4cf9bc3000, 1ffecb5d71eb90, 1ffecb5affb030, 0, 1ffecb5d852cd0) + 50
 001ffecb5d722d48 backend_run_single_int (12f400, fffffffffffffffa, 1ffecb5affb118, 135800, 4cf8209c58, 1ffecb5d84e000) + 38
 001ffecb5d733ecc prop_remove (1ffecb5affb660, 135800, 0, 0, 1dde8, 1ffecb5d84e000) + 1b4
 001ffecb5d722a24 backend_exec (4cf82facd8, 1ffecb5d733d18, 1ffecb5affb660, 1ffecb5affb2a0, 4, 0) + 10c
 001ffecb5d722ac8 backend_tx_run (4cf9e673c0, 4cf9e66490, 1ffecb5d733d18, 1ffecb5affb660, 1, 1ffecb5d852cd0) + 50
 001ffecb5d7343e8 pg_remove (1ffecb5affb660, 1ffecb5cc069d0, 0, 1ffecb5d7184cf, ffffffffffee5d18, 1ffecb5d84e000) + 368
 001ffecb5d722a24 backend_exec (4cf82fb598, 1ffecb5d734080, 1ffecb5affb660, 1ffecb5affb510, 5, 0) + 10c
 001ffecb5d722ac8 backend_tx_run (4cf9e673c0, 4cf9c22470, 1ffecb5d734080, 1ffecb5affb660, 1, 1ffecb5d852cd0) + 50
 001ffecb5d735174 object_remove (4cf8925310, 3, ffffffffffee6080, 1ffecb5cbd5240, 0, 0) + 2f4
 001ffecb5d745dc8 rc_remove (0, 1ffecb5affbb4c, 0, 0, 0, 0) + 300
 001ffecb5d7288c0 bundle_remove (4cf86a5550, 1ffecb5affbb40, 9a, 1ffecb5cbd5240, 1ffecb5cbd5240, fffffffffffffffd) + 58
 001ffecb5d72a110 simple_handler (4cf86a5550, 1ffecb5affbb40, 40c, 1ffecb5affba1c, 1ffecb5affba20, 1ffecb5d728868) + 28
 001ffecb5d72a7ec client_switcher (32, 1ffecb5affbb40, 40c, 1ffecb5d8511b8, 4, 4cf8250ae0) + 264
 001ffecb5cfe256c __door_return (0, 0, 0, 0, 0, 0) + 54

and I am not sure what those stack top functions are or what they do. Are there any known issues with these functions that could cause a hang during reading/writing data to the db?

(2) By Richard Hipp (drh) on 2021-05-26 11:36:48 in reply to 1.1 [link] [source]

__pread() is a call into your operating system to obtain content from a file on disk. I don't know why it is stuck. The SQLite terms on the stack are all just trying to read a single page of the database file from disk into memory.