SQLite Forum

[bug] sqlite3 binrary does not unregister extensions/vfs at exit()
The sqlite3 binary evidently calls exit() directly on error. This makes some cleanup extremely difficult when VFS userdata reference structures or threads that must be torn down. This causes at least two problems for the ceph VFS [1]:

- Any global/static structures will be destructed by C++ which can cause segmentation faults or other errors when library threads continue referencing that memory during the exit procedure.

- Any connections with distributed systems (like Ceph) will essentially time out causing automatic fencing/blocklisting procedures. This is unnecessary expense that can be avoided.

Now, I probably will have to fix this by registering atexit handlers to tear down ceph library state for this situation. This is unsatisfactory however because I need to store VFS state in a static-duration structure. It would be much better if SQLite unregistered the VFS or called some new VFS shutdown method.

[1] <https://docs.ceph.com/en/latest/rados/api/libcephsqlite/>

Kind regards,

Patrick Donnelly