retorquere / zotero-better-bibtex

Make Zotero effective for us LaTeX holdouts
https://retorque.re/zotero-better-bibtex/
MIT License
5.42k stars 290 forks source link

Multiple errors on shutdown / startup #2948

Closed MrSerth closed 2 months ago

MrSerth commented 3 months ago

Debug log ID

N/A, since BBT wasn't loaded any longer After a restart: X9SLMXCX-fio-24vflMf76l5q

What happened?

This issue is probably a follow-up to #2892.

Zotero just crashed during the update from 7.0.0 to 7.0.1. After I started it again, it first worked fine. As soon as I closed Zotero, I saw two errors

Better BibTeX shutdown failed
InvalidStateError: IDBDatabase.transaction: Can't start a transaction on a closed database
Bildschirmfoto 2024-08-15 um 11 34 27

directly followed by:

Better BibTeX startup failed
Error: Better BibTeX is already started
Bildschirmfoto 2024-08-15 um 11 34 33

In the development console, another error is shown (that I reported earlier as #2892 already):

Zotero.getMainWindow() is null [better-bibtex.js:8695](jar:file://~/Library/Application%20Support/Zotero/Profiles/protcja8.default/extensions/better-bibtex@iris-advies.com.xpi!/content/better-bibtex.js)
Development Console

![Bildschirmfoto 2024-08-15 um 11 44 56](https://github.com/user-attachments/assets/fad0fbb4-98b8-49e0-a30c-6ec22021db03)

Further, I saw two other warnings when looking into the logs:

addons.xpi-utils    WARN    Add-on better-bibtex@iris-advies.com is not compatible with application version.
Missing resource in locale de: better-bibtex.ftl
Development Console as text

``` DEPRECATION WARNING: Calling FileUtils.getDir(..., ..., true) causes main thread I/O and should be avoided especially during startup/shutdown You may find more details about this deprecation at: https://bugzilla.mozilla.org/show_bug.cgi?id=921157 resource://gre/modules/FileUtils.sys.mjs 62 FileUtils_getDir resource://gre/modules/UpdateService.sys.mjs 1057 getUpdateDirCreate resource://gre/modules/UpdateService.sys.mjs 1160 getReadyUpdateDir resource://gre/modules/UpdateService.sys.mjs 1332 cleanUpReadyUpdateDir resource://gre/modules/UpdateService.sys.mjs 1442 cleanupReadyUpdate resource://gre/modules/UpdateService.sys.mjs 3116 AUS__postUpdateProcessing resource://gre/modules/UpdateService.sys.mjs 2715 AUS_observe resource://gre/modules/UpdateServiceStub.sys.mjs 109 UpdateServiceStub [Deprecated.sys.mjs:79:13](resource://gre/modules/Deprecated.sys.mjs) warning resource://gre/modules/Deprecated.sys.mjs:79 FileUtils_getDir resource://gre/modules/FileUtils.sys.mjs:62 getUpdateDirCreate resource://gre/modules/UpdateService.sys.mjs:1057 getReadyUpdateDir resource://gre/modules/UpdateService.sys.mjs:1160 cleanUpReadyUpdateDir resource://gre/modules/UpdateService.sys.mjs:1332 cleanupReadyUpdate resource://gre/modules/UpdateService.sys.mjs:1442 AUS__postUpdateProcessing resource://gre/modules/UpdateService.sys.mjs:3116 AUS_observe resource://gre/modules/UpdateService.sys.mjs:2715 UpdateServiceStub resource://gre/modules/UpdateServiceStub.sys.mjs:109 Error: Addon must include an id, version, and type 2 [XPIProvider.jsm:1723:13](resource://gre/modules/addons/XPIProvider.jsm) unreachable code after return statement [util.js:205:4](resource://zotero/bluebird/util.js) Missing resource in locale de: better-bibtex.ftl Plugin better-bibtex@iris-advies.com is missing bootstrap method 'onMainWindowUnload' Zotero.getMainWindow() is null [better-bibtex.js:8695](jar:file://~/Library/Application%20Support/Zotero/Profiles/protcja8.default/extensions/better-bibtex@iris-advies.com.xpi!/content/better-bibtex.js) 1723714458819 addons.xpi-utils WARN Add-on better-bibtex@iris-advies.com is not compatible with application version. 3 Missing resource in locale de: toolkit/global/commonDialog.ftl 2 InstallTrigger is deprecated and will be removed in the future. 4 [reader.js:20134:16](resource://zotero/reader/reader.js) Missing resource in locale de: better-bibtex.ftl DOMException: Could not get children of file(~/Library/Application Support/Zotero/Crash Reports/events) because it does not exist [CrashManager.sys.mjs:663:17](resource://gre/modules/CrashManager.sys.mjs) _getUnprocessedEventsFiles resource://gre/modules/CrashManager.sys.mjs:663 Missing resource in locale de: toolkit/about/aboutAddons.ftl Missing resource in locale de: toolkit/about/abuseReports.ftl Missing resource in locale de: browser/components/mozSupportLink.ftl 2 Missing resource in locale de: toolkit/global/extensions.ftl This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “”. ```

Zotero Debug output

``` 1723714426727 addons.xpi WARN Checking /Applications/Zotero.app/Contents/Resources/distribution/extensions for addons 1723714426847 addons.xpi-utils WARN addMetadata: Add-on undefined is invalid: Error: Invalid addon ID: expected addon ID undefined, found undefined in manifest(resource://gre/modules/addons/XPIDatabase.jsm:3108:15) JS Stack trace: addMetadata@XPIDatabase.jsm:3108:15 processFileChanges@XPIDatabase.jsm:3569:26 checkForChanges@XPIProvider.jsm:3121:60 startup@XPIProvider.jsm:2532:12 callProvider@AddonManager.sys.mjs:228:31 _startProvider@AddonManager.sys.mjs:536:17 startup@AddonManager.sys.mjs:742:14 startup@AddonManager.sys.mjs:3666:26 observe@amManager.sys.mjs:73:29 [JavaScript Error: "Error: Addon must include an id, version, and type" {file: "resource://gre/modules/addons/XPIProvider.jsm" line: 1723}] [JavaScript Error: "Error: Addon must include an id, version, and type" {file: "resource://gre/modules/addons/XPIProvider.jsm" line: 1723}] [JavaScript Error: "Zotero.getMainWindow() is null" {file: "jar:file://~/Library/Application%20Support/Zotero/Profiles/protcja8.default/extensions/better-bibtex@iris-advies.com.xpi!/content/better-bibtex.js" line: 8695}] 1723714458819 addons.xpi-utils WARN Add-on better-bibtex@iris-advies.com is not compatible with application version. 1723714458819 addons.xpi-utils WARN Add-on better-bibtex@iris-advies.com is not compatible with application version. 1723714458819 addons.xpi-utils WARN Add-on better-bibtex@iris-advies.com is not compatible with application version. appName => Zotero, version => 7.0.1 (ARM64), os => macOS 14.6.1, locale => de, extensions => Better BibTex for Zotero (6.7.221, extension) ```

Please let me know if you need further details or assistance with the localization for German. Thanks for the great plugin.

retorquere commented 2 months ago

It wasn't a minor issue it turns out.

MrSerth commented 2 months ago

Glad to test the next version, too. Here are two debug logs:

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.231.7016 ("separate tx for each key")

This update may name other issues, but the build just dropped here is for you; it just means problems already fixed in other issues have been folded into the work we are doing here. Install in Zotero by downloading test build 6.7.231.7016, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 2 months ago

you know the drill.

MrSerth commented 2 months ago

Sure, here's the next log: PANN75V6-euc/6.7.231.7016-7.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.232.7031 ("what is failing?")

This update may name other issues, but the build just dropped here is for you; it just means problems already fixed in other issues have been folded into the work we are doing here. Install in Zotero by downloading test build 6.7.232.7031, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

MrSerth commented 2 months ago

... and here you are again: SLFC35EQ-euc/6.7.232.7031-7

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.232.7034 ("no metadata then")

This update may name other issues, but the build just dropped here is for you; it just means problems already fixed in other issues have been folded into the work we are doing here. Install in Zotero by downloading test build 6.7.232.7034, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

MrSerth commented 2 months ago

Here's another log file: G75JJLB8-euc/6.7.232.7034-7. I tried reproducing the issue multiple times, so that the log is pretty long. I made one observation, which I correlate to the cache dump occurrence: Before the issue occurred, I chose to display the cite key in the main list of publications. This column stayed there for multiple close and reopen cycles. However, as soon as the cache dump issue occurs, this column is just removed from the main list. I can then re-add it without problems and it is showing the expected cite key.

I was just wondering whether this is something you can relate to. I don't necessary want to say that one issue is causing the other, but I wanted to say that both seem to occur at the same time.

The log further shows an loadUI error I have never seen before (might be BBT-related), but this occurred way before the cite key column got removed and the cache dump failed.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.232.7036 ("metadata fetch")

This update may name other issues, but the build just dropped here is for you; it just means problems already fixed in other issues have been folded into the work we are doing here. Install in Zotero by downloading test build 6.7.232.7036, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 2 months ago

Here's another log file: G75JJLB8-euc/6.7.232.7034-7. I tried reproducing the issue multiple times, so that the log is pretty long. I made one observation, which I correlate to the cache dump occurrence: Before the issue occurred, I chose to display the cite key in the main list of publications. This column stayed there for multiple close and reopen cycles. However, as soon as the cache dump issue occurs, this column is just removed from the main list. I can then re-add it without problems and it is showing the expected cite key.

I think the new build solves the cache dump issue.

I was just wondering whether this is something you can relate to. I don't necessary want to say that one issue is causing the other, but I wanted to say that both seem to occur at the same time.

I don't really see how these could be related, but I am not ruling it out.

The log further shows an loadUI error I have never seen before (might be BBT-related), but this occurred way before the cite key column got removed and the cache dump failed.

That's something I'm going to fix in #2965

MrSerth commented 2 months ago

I think the new build solves the cache dump issue.

I hope so, too, and didn't notice any remaining issues with that.

I don't really see how these could be related, but I am not ruling it out.

On the new tests I performed for build 7034, I observed that the column got removed a few times again, but without any cache dump issue.

That's something I'm going to fix in https://github.com/retorquere/zotero-better-bibtex/issues/2965

:+1:


Just to be sure that all startup issues are resolved, here are two debug logs for a final (🤞) check:

retorquere commented 2 months ago

awesome. I'm rolling this out to release ahead of #2865 -- this already solves a real problem.

MrSerth commented 2 months ago

Awesome, thank you once again for all the time you spent in debugging and fixing the issue! 👏

retorquere commented 2 months ago

And you for sticking this one out. It must have cost you a lot of time too.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.235.7046 ("Merge branch 'master' into gh-2948")

This update may name other issues, but the build just dropped here is for you; it just means problems already fixed in other issues have been folded into the work we are doing here. Install in Zotero by downloading test build 6.7.235.7046, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".