open-spaced-repetition / fsrs4anki-helper

An Anki add-on that supports Postpone & Advance & Load Balance & Easy Days & Disperse Siblings
https://ankiweb.net/shared/info/759844606
MIT License
175 stars 15 forks source link

[BUG] Getting "Anki has encountered an unexpected error when closing Anki. #400

Open jonahspear-toast opened 2 months ago

jonahspear-toast commented 2 months ago

Describe the bug

Getting "Anki has encountered an unexpected error when closing Anki. Anki is saying that it is an issue with fsrs4anki-helper. Here is the debug info:

Anki 23.12.1 (1a1d4d54) (ao) Python 3.9.15 Qt 6.5.3 PyQt 6.5.3 Platform: macOS-14.3.1-arm64-arm-64bit

Traceback (most recent call last): File "aqt.taskman", line 142, in _on_closures_pending File "aqt.taskman", line 86, in File "/Users/jspear/Library/Application Support/Anki2/addons21/759844606/schedule/reschedule.py", line 171, in on_done mw.reset() File "aqt.main", line 851, in reset File "aqt.main", line 803, in _synthesize_op_did_execute_from_reset File "_aqt.hooks", line 3840, in call File "aqt.deckchooser", line 120, in on_operation_did_execute File "aqt.deckchooser", line 82, in _update_button_label RuntimeError: wrapped C/C++ object of type QPushButton has been deleted

===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) Advanced Review Bottom Bar ['1136455830', 2024-02-04T13:38, 'None', mod] FSRS4Anki Helper ['759844606', 2024-04-26T13:38, 'None', mod] Image Occlusion Enhanced ['1374772155', 2022-04-09T03:15, 'None', ''] PassFail 2 Remove the Easy and Hard buttons ['876946123', 2023-01-23T20:59, 'None', ''] Progress Bar cards done cards left secondscard time spentleft and ETA ['1097423555', 2023-10-02T04:05, 'None', mod] Puppy Reinforcement ['1722658993', 2023-11-16T07:59, 'None', ''] Reset Ease ['947935257', 2023-11-11T20:22, 'None', ''] Review Heatmap ['1771074083', 2022-06-29T21:43, 'None', ''] right hand reviews hjkl answer shortcuts Handy Answer Keys configurable ['850294128', 2023-05-24T05:00, 'None', '']

===IDs of active AnkiWeb add-ons=== 1097423555 1136455830 1374772155 1722658993 1771074083 759844606 850294128 876946123 947935257

===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed])

A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment

Additional context Add any other context about the problem here.

L-M-Sherlock commented 2 months ago

Which feature do you enable in the helper add-on?

jonahspear-toast commented 2 months ago
image

here are my enabled features. Please let me know if there's anything else I can provide

L-M-Sherlock commented 1 month ago

Sorry for this delayed reply. I have come back from my vacation just now. I cannot reproduce your issue. How many times do you meet this error?

L-M-Sherlock commented 1 month ago

It will be fixed in Anki's part: https://github.com/ankitects/anki/issues/3190

RichFS-Liao commented 4 weeks ago

I'm not sure if others have encountered the same issue, but I've noticed that when I close Anki, it remains in the background processes. This prevents me from reopening Anki next time, requiring me to manually close Anki from the Task Manager.

I've made several attempts to troubleshoot, and as a conclusion, the error seems to occur during the synchronization process when closing Anki, and it only happens when there's nothing to synchronize.

I've found that commenting out lines 96 and 97 in sync_hook.py can avoid this situation (for testing purposes, not as a solution). This might help in pinpointing the entry point of the problem.

L-M-Sherlock commented 4 weeks ago

It's a problem related to Orphan Process. FSRS helper add-on runs rescheduling and dispersing in subprocess of Anki. Sometimes the main process of Anki has been terminated, but the subprocess is still running.

Yell0whead commented 3 weeks ago

Hi there,

For what it's worth, I've also been encountering this issue.

I'm currently using Anki version:

24.04.1 (ccd9ca1a)⁩ Python 3.9.18 Qt 6.6.2 PyQt 6.6.1

where having the add-on enabled prevents Anki from properly closing/quitting. This is on MacOS:

Sonoma 14.5 (23F79)

This issue occurs whether one A) closes via the red "x" button on the top-left of the window, B) closes by right-clicking the app and selecting "Quit", or C) closes by using the Cmd + Q hotkey.

I've confirmed the following other troubleshooting steps, and isolated it to this add-on. FYI, the following add-on also causes the same behaviour, and you can find a submitted bug report here:

Auto Sync (501542723)