async shutdown listener

17 views
Skip to first unread message

Emiliano Heyns

unread,
Aug 12, 2017, 8:40:57 PM8/12/17
to zotero-dev
If I'm not mistaken the shutdown listeners are currently sync. It would be very useful for me to be able to save data to the DB at shutdown, but for that I would need to have the listener proceed only when that save is finished. Is this possible? Planned?

Emiliano Heyns

unread,
Aug 13, 2017, 3:29:41 PM8/13/17
to zotero-dev
On Sunday, August 13, 2017 at 2:40:57 AM UTC+2, Emiliano Heyns wrote:
If I'm not mistaken the shutdown listeners are currently sync. It would be very useful for me to be able to save data to the DB at shutdown, but for that I would need to have the listener proceed only when that save is finished. Is this possible? Planned?

As a corollary to this, I'm allocating my own Zotero.DBCollection for storage, but I'm getting this error when I try to shut it down at the start of a wrapped Zotero.shutdown

FATAL ERROR: AsyncShutdown timeout in profile-before-change Conditions: [{"name":"Sqlite.jsm shutdown blocker","state":{"description":"Waiting for connections to close","state":[{"name":"zotero.sqlite#0: waiting for shutdown","state":{"identifier":"zotero.sqlite#0","isCloseRequested":false,"hasDbConn":true,"hasInProgressTransaction":false,"pendingStatements":0,"statementCounter":16961},"filename":"resource://gre/modules/Sqlite.jsm","lineNumber":259,"stack":["resource://gre/modules/Sqlite.jsm:ConnectionData:259","resource://gre/modules/Sqlite.jsm:OpenedConnection:1151","resource://gre/modules/Sqlite.jsm:openConnection/</<:960"]},{"name":"better_bibtex.sqlite#0: waiting for shutdown","state":{"identifier":"better_bibtex.sqlite#0","isCloseRequested":false,"hasDbConn":true,"hasInProgressTransaction":false,"pendingStatements":0,"statementCounter":108},"filename":"resource://gre/modules/Sqlite.jsm","lineNumber":259,"stack":["resource://gre/modules/Sqlite.jsm:ConnectionData:259","resource://gre/modules/Sqlite.jsm:OpenedConnection:1151","resource://gre/modules/Sqlite.jsm:openConnection/</<:960"]}]},"filename":"resource://gre/modules/Sqlite.jsm","lineNumber":157,"stack":["resource://gre/modules/Sqlite.jsm:null:157","resource://gre/modules/XPCOMUtils.jsm:get:198","resource://gre/modules/Sqlite.jsm:ConnectionData:259","resource://gre/modules/Sqlite.jsm:OpenedConnection:1151","resource://gre/modules/Sqlite.jsm:openConnection/</<:960"]}] At least one completion condition failed to complete within a reasonable amount of time. Causing a crash to ensure that we do not leave the user with an unresponsive process draining resources.
WARNING: No crash reporter available
^G[18135] ###!!! ABORT: file resource://gre/modules/Sqlite.jsm, line 157
[18135] ###!!! ABORT: file resource://gre/modules/Sqlite.jsm, line 157

I'd rather not create new tables in the main Zotero DB, but I'd need a way for my DB to be closed properly. Would it be possible to have Zotero just register all requested DB connections and close them at shutdown?

Emiliano Heyns

unread,
Aug 14, 2017, 1:56:48 PM8/14/17
to zotero-dev
Never mind, found AsyncShutdown.profileBeforeChange 

Emiliano Heyns

unread,
Aug 15, 2020, 10:59:35 AM8/15/20
to zotero-dev
Coming back to this in the face of https://forums.zotero.org/discussion/84537/sqlite-jsm-better-bibtex-sql-shutdown-blocker-problem-zotero-closing-takes-lots-of-time-export -- I'm not sure why this takes so long because the BBT database is typically very small; a very large database would be a few MB. But what is the proper place to register a shutdown handler in Zotero? I know I can register a shutdown listener but those are called without waiting for their completion.
Reply all
Reply to author
Forward
0 new messages