retorquere / zotero-better-bibtex

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

Multiple errors on shutdown / startup #2948

Closed MrSerth closed 1 month ago

MrSerth commented 2 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.

github-actions[bot] commented 2 months ago

Hello @MrSerth,

@retorquere is ready to assist you with Better BibTeX. In order to do so efficiently, a debug log is generally required. The information it containst is key to him understanding, replicating, and resolving your issue.

Here’s how you can share your debug log:

  1. If your issue involves specific references, citekey generation, or exports, right-click on the relevant item(s) and select "Better BibTeX -> Submit Better BibTeX debug log" from the menu.
  2. For issues where items do not play a role, follow these steps:
    • Restart Zotero with debugging enabled (Help -> Debug Output Logging -> Restart with logging enabled).
    • Reproduce the problem.
    • Choose "Send Better BibTeX debug report..." from the help menu.

After these steps, you will receive debug ID displayed in red. Please share this ID with @retorquere in this issue thread. If your query is about an export, include both the actually exported result and your expected/desired outcome.

Sharing your debug log gives @retorquere a view of your Better BibTeX configuration and the elements contributing to the issue. This helps him address your concerns more efficiently.

Thank you.

PS: If the Debug Log menu is not available, or if it fails to send the debug log, you can use the option under “Help” > “Send debug log to file.io”.

MrSerth commented 2 months ago

I just created a debug log, but would assume that it doesn't contain any useful details (since I had to restart BBT): X9SLMXCX-fio-24vflMf76l5q

retorquere commented 2 months ago

I'm looking into it but my response times are slower than usual, the zotero 7 release is bringing in a spike of requests, and I'm currently away to a competition with limited time to get behind a computer. I'm doing my best to address the issues and will be back to normal response times on Tuesday. I don't know why zotero 7 release responds differently than the beta I was testing on.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.221.2948.6758 ("upgrades")

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.221.2948.6758, 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

I just tried installing the test build dropped above. However, the installation failed. In the console, I see the following error:

addons.webextension.better-bibtex@iris-advies.com   WARN    Loading extension 'better-bibtex@iris-advies.com': Reading manifest: Warning processing version: version must be a version string consisting of at most 4 integers of at most 9 digits without leading zeros, and separated with dots
addons.xpi-utils    WARN    Add-on better-bibtex@iris-advies.com is not compatible with application version. 4
retorquere commented 2 months ago

Yeah you can ignore that. I've reported it to the Zotero team -- for some reason 4-part version numbers trigger this warning, but the plugin otherwise runs as normal.

retorquere commented 2 months ago

Are you sure it fails? Is it not just the message?

MrSerth commented 2 months ago

No, unfortunately I cannot install it. I tried multiple times. Upon installation the following error is shown (in German, but simply says:

Failed to install the extension
The extension “Better BibTex for Zotero” could not be installed. It may be incompatible with this version of Zotero.
Bildschirmfoto 2024-08-16 um 20 50 50

Even after quitting Zotero, re-checking and trying again, the version has not changed:

Bildschirmfoto 2024-08-16 um 20 50 34
retorquere commented 2 months ago

Oh that's just fantastic. This behavior wasn't in the betas. I'll have to see what the zotero team says, I've notified them, but it looks like the 5 part version numbers that I've used for debug builds forever are now suddenly cause to reject installation.

I don't have access to my regular workstation, and internet access here is crap, so I'm a bit handicapped in what I can diagnose currently, sorry.

MrSerth commented 2 months ago

Thanks for investigating and checking back with the Zotero team. I am sorry to hear about all those differences between the previous beta builds and the release version of Zotero 7.

Please take your time abroad and don't worry about my issue; I'll be patient and will be happy to hear back whenever you have the necessary resources.

retorquere commented 2 months ago

The next build to drop has one less number in the version. Let me know whether that works.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.221.6761 ("skip issue number in version")

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.221.6761, 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

I am really sorry to say but the new build has the very same error as the previous one (Add-on better-bibtex@iris-advies.com is not compatible with application version.). Once again, I tried multiple times (just to be sure), but the version number shown in the plugins pane hasn't changed.

retorquere commented 2 months ago

And https://github.com/retorquere/zotero-better-bibtex/releases/download/builds/zotero-better-bibtex-5.7.221.xpi ?

MrSerth commented 2 months ago

No, I can't install it either -- am I making something wrong?

Upon installation, I got the same (already known) error message. This time, however, the plugins pane also announces "Available Updates: 1". Clicking on this entry shows ... nothing.

Screenshots

Bildschirmfoto 2024-08-16 um 23 52 02 Bildschirmfoto 2024-08-16 um 23 52 03

Just for my understanding: Could it be that the strict_min_version specified in the manifest.json is not correct? In the most recent https://github.com/retorquere/zotero-better-bibtex/releases/download/builds/zotero-better-bibtex-5.7.221.xpi, I see the following:

  "applications": {
    "zotero": {
      "id": "better-bibtex@iris-advies.com",
      "update_url": "https://github.com/retorquere/zotero-better-bibtex/releases/download/release/updates.json",
      "strict_min_version": "8.0",
      "strict_max_version": "7.0.*"
    }
  }

My Zotero version is 7.0.1, running on macOS 14.6.1. For completeness, I captured another debug log (while trying to install the custom build from this issue): 2FZGRI3K-euc/6.7.221-7.

retorquere commented 2 months ago

I am such a moron -- you are right, new build incoming.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.221.2948.6764 ("upgrades")

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.221.2948.6764, 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

The new build is still not working (same error) and the manifest still contains "strict_min_version": "8.0".

retorquere commented 2 months ago

New build incoming. Sorry about all of this, I'm ssh-ing into a headless box over a connection that makes me think back fondly of stable 56k6 dialup. My test suite catches most problems but I can't test anything visually.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.221.2948.6767 ("skip beta workaround")

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.221.2948.6767, 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

Thank you so much, I successfully installed the new version ... and immediately got the same error as originally reported (shutdown and startup failed). After trying a few times, I also got some debug logging when this error happened 🥳. Here's the log: 2FZGRI3J-euc/6.7.221.2948.6767-7.

retorquere commented 2 months ago

A new build will drop soon, please install that, restart Zotero, and attempt to reproduce the problem.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.222.2948.6779 ("shut down as much as possible when encountering an error")

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.222.2948.6779, 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

I attempted reproducing the issue (which is not trivial, since I don't know yet when exactly the issue happens). I have two debug logs for you:

As soon as the issue happens, sending debug logs is much harder, since the corresponding pane isn't loading any longer. For the second log that's the case, so I would assume you'll find some traces there.

Screenshot of unsuccessful pane loading to submit debug logs

Bildschirmfoto 2024-08-18 um 00 32 30

retorquere commented 2 months ago

The first log already shows the problem I think. New build incoming, same procedure please.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.222.6782 ("why is zotero immediately disabling BBT?")

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.222.6782, 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

Thanks! The issue reoccurred, and I've sent another debug log U459HRMB-euc/6.7.222.6782-7. The second last line shows one of the issues: InvalidStateError: IDBDatabase.transaction: Can't start a transaction on a closed database.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.222.6807 ("cache flush")

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.222.6807, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.222.6809 ("strip logging")

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.222.6809, 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

Unfortunately, the problem still persists, here is another debug log: U459HRMC-euc/6.7.222.6807-7.

I also made quite good progress in just closing the Zotero window on macOS without quitting it (Like in cmd + W rather than cmd + Q). Doing so (and waiting a bit before and after) allows me to reproduce the issue more or less reliable. Still no guarantee that the bug will be triggered, but pretty close already. And to check whether the bug occurred, it's the easiest to open the "Send BBT debug logs..." pane. If it is not loading any of the dynamic text, the bug occurred.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.226.6857 ("who is closing the cache?")

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.226.6857, 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

Please send a new log from 6857

MrSerth commented 2 months ago

Sure, here you go: U459HRMD-euc/6.7.226.6857-7

retorquere commented 2 months ago

Is that verbatim from the error report screen?

MrSerth commented 2 months ago

It's the output from "Help" > "Debug Output Logging" > "Show Log". Since BBT crashes, I cannot use the integrated error reporting.

BBT Error Reporting

Bildschirmfoto 2024-08-29 um 09 39 30

I still have the window open; let me know if you need more / other logs.

retorquere commented 2 months ago

The thing is there's supposed to be a slash in the ID. You can double-click the ID to select it, then paste it. That's not an ID that BBT will generate.

It's the output from "Help" > "Debug Output Logging" > "Show Log". Since BBT crashes, I cannot use the integrated error reporting.

... then how did you get that into my debug log pipeline? Because I'm picking up the logs from my pipeline. I was wondering why the header was missing from the logs. Are you assembling these yourself and sending them to AWS?

A new build will drop in a few minutes that will keep the FIO log option always enabled. Please use that.

MrSerth commented 2 months ago

The thing is there's supposed to be a slash in the ID. You can double-click the ID to select it, then paste it. That's not an ID that BBT will generate.

Sorry, I fixed the ID.

... then how did you get that into my debug log pipeline? Because I'm picking up the logs from my pipeline. I was wondering why the header was missing from the logs. Are you assembling these yourself and sending them to AWS?

Yes.

A new build will drop in a few minutes that will keep the FIO log option always enabled. Please use that.

Will try.

retorquere commented 2 months ago

... then how did you get that into my debug log pipeline? Because I'm picking up the logs from my pipeline. I was wondering why the header was missing from the logs. Are you assembling these yourself and sending them to AWS?

Yes.

Please don't.

retorquere commented 2 months ago

Also U459HRMD-euc/6.7.226.6857-7 talks about starting up 6.7.222.6782. These IDs contain meaningful information to me. Please don't hand-assemble them, it makes the information I get from them untrustworthy.

MrSerth commented 2 months ago

Then, something went seriously wrong. The log I sent contained (in line 5):

appName => Zotero, version => 7.0.1 (ARM64), os => macOS 14.6.1, locale => de, extensions => Better BibTex for Zotero (6.7.226.6857, extension)

I have the newest version installed:

Bildschirmfoto 2024-08-29 um 09 53 44
github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.226.6859 ("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.226.6859, 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

Sorry for breaking your debug pipeline; that wasn't my intention.

I installed version 6859, but still cannot upload logs.

Bildschirmfoto 2024-08-29 um 12 15 38
retorquere commented 2 months ago

But doesn't the fio log uploader in the Help menu work?

retorquere commented 2 months ago

appName => Zotero, version => 7.0.1 (ARM64), os => macOS 14.6.1, locale => de, extensions => Better BibTex for Zotero (6.7.226.6857, extension)

Right, but line 608 reads

Calling bootstrap method 'startup' for plugin better-bibtex@iris-advies.com version 6.7.222.6782 with reason APP_STARTUP

so I don't know what's going right now. A new build is underway that will log the running version in the log messages.

MrSerth commented 2 months ago

But doesn't the fio log uploader in the Help menu work?

I was able to submit an error report to Zotero, but I assume you cannot access. The report ID is 216159850. Further, I can send another log, generated with the ID D1662925960. You don't have access either, I guess.

Which other menu option are you referring to? Here's my "Help" pane:

Bildschirmfoto 2024-08-29 um 13 20 30

So far, I tried using "Send BBT debug logs".

retorquere commented 2 months ago

The fio log doesn't even seem to init then. Can you install https://github.com/retorquere/zotero-debug-log/releases/tag/v2.0.17? That will put the fio log in the help menu. I do indeed not have access to D<number> logs.

github-actions[bot] commented 2 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.226.6865 ("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.226.6865, 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

I am out of luck, sorry. I installed https://github.com/retorquere/zotero-debug-log/releases/tag/v2.0.17 and verified that I had two new options in the "Help" menu to send debug logs to file.io. This worked. Then, I quit Zotero completely (just to be sure), and restarted (a second time), this time with debugging enabled. Then; I reproduced the issue.

After having the erroneous state, I thought sending a debug log would be easy. However, the menu entry to send logs completely vanished. Before giving up, I went to the plugins pane, disabled the "Debug Log for Zotero" plugin (not BBT), and enabled it again (in a hope this would reinitialize the plugin, giving me the menu option again). Luckily, it re-added the menu, but just with a single option to send "Debug Logs" (the second entry to send BBT logs was still gone). Then, I went ahead and clicked that link option to send Debug Logs. Upon clicking, I got the following error:

Bildschirmfoto 2024-08-29 um 18 09 36

I can repeat this process, but it seems like no log is being sent.

Do you have any idea what could be going so bad with my Zotero installation? I don't have any plugin installed except yours (BBT + debug log). I created a clean profile with Zotero 7 and "just" imported my existing library afterwards.

retorquere commented 2 months ago

If BBT isn't present in the fio menu that's not a problem, the generic option has most of what I need for this. I'll be AFK for a few hours but will look into the secondary plug-in when I'm back. Sorry for this mess, and thanks for sticking this out.

retorquere commented 2 months ago

Ah fortunately that popup is easy to fix.