Steps to reproduce the c[0] bug: D312361246

edited April 7, 2019
This will do it:

1. Open or create a document with citations.
2. With the document open, stop and restart Zotero.
3. Select a citation and open it for editing with the Classic popup.
4. Show the editor. Citation will appear in the editor. Press Cancel.
5. Refresh citations.
6. Boom.

The Debug ID above covers those steps. For further exploration:

7. Save the document and stop the word processor.
8. Reopen the document.
9. Click Refresh.
10. Boom.
11. Restart Zotero.
12. In the document, refresh citations.
13. All systems normal, the document works again.

The trigger, in this case at least, is at Step 3. When the Classic editor is opened before any other actions are taken, the citations array used to declare the context of the preview is still empty. This drains the processor registry, and subsequent operations that assume the processor has been fully initialized will fail.
  • edited April 8, 2019
    Here is a second way to trigger the c[0] bug, using the Quick Format dialog:

    1. Open or create a document with citations in the Cell style.
    2. With the document open, stop and restart Zotero.
    3. Select a citation and open it for editing with the Quick Format dialog.
    4. Add a citation bubble to the Quick Format dialog, and press the escape key (Esc) to cancel the dialog (without adding the item to the citation).
    5. Open another citation, and attempt to add the item to it, hitting Enter to complete the insert.
    6. Boom.

    Both tests were done in LibreOffice under Linux with Track Changes disabled, using Zotero 5.0.65, off the shelf with no modifications.
  • edited April 8, 2019
    Can confirm that the same actions trigger the bug in Word 2013 under Windows 10 with Zotero 5.0.65.
  • In all cases, stopping and restarting Zotero followed by Refresh fixes it -- ephemeral data in Zotero is corrupted by the crash, but the problem goes away when the program is restarted, so long as the restart is not followed by another cancelled insertion. The document itself is not corrupted in any way.
  • Also, the bug does not trigger if citation updates are delayed. It triggers only when automatic citation updates are enabled.
  • Thanks for finding the steps to reproduce this, @fbennett. You can view my commit to see how I ended up addressing this bug.
  • @fbennett: The commit is now available in the latest beta, if you want to check any steps to reproduce.
  • edited April 10, 2019
    Well, almost. The new commit runs stable, but the processor is being presented with irrational input that may affect the operation of Zotero in unpredictable ways. Here are the sort of arrays it is seeing, not only when opening the Classic editor, but when preparing to insert citations in Quick Format in any style that sorts citations. Here is a trace taken with the Cell style, while inserting a citation into a document containing four citations:

    (1)(+0001008): citationsPre=[["Q43HSBCq",0],["LaXf285q",0],["IN8UWros",0],["1MJXLBtg",0]]

    (1)(+0000000): citationsPost=[["1MJXLBtg",0]]

    You see the problem. The processor is being told that the document contains five citations, two of which have identical IDs. I flagged the cause of this a couple of times previously, but maybe I didn't explain myself clearly enough. There is a string that needs to be converted to an integer here. The next processor release will throw an error when it receives irrational context inputs, so it would be a good idea to fix this soon.
  • Oh, thanks for pointing this out. I had taken a mental note and missed this one by accident.
  • @fbennett: OK, try the latest beta.
  • All good now. The pre- and post- arrays are unique, and reflect the field position in the document. It should make sense to the beast. I wasn't able to pin down any lasting side effects from the overrun, but you never know - and it saves a few cycles in the processor. Thanks for fixing this.
Sign In or Register to comment.