It appears to be a bug either in the web toolkit, or macOS. You could try updating macOS to see if it helps. After mid Jan we can try updating to a new toolkit version, which may also help.
I first tested Anki 3 times, just by doing some reviews, going into Browser, and changing the deck for a card, etc. Nothing crashed those times, and my add-ons were turned OFF from the last time of use.
On the 4th time, I turned on my add-ons and then quit Anki, and I got the crash again. So I turned off the add-ons and did some review then exitedā¦ and I still got the crash. Now I keep getting subsequent crashes.
I wonder if activating add-ons is somehow causing a memory problem for macOS, and itās stuck in that state, but honestly Iām probably far off.
Also, Shift-click Anki does not produce this crash
It is possible there is some sort of resource leak in macOS that is triggering it. Further experimentation may reveal more - for example if after the 3 times without add-ons you continued to avoid add-ons, I wonder whether the issue would crop up again after enough time, or if it would be gone for good?
I will definitely be willing to try that, but I donāt know how to get back to a state of non-crashing. If there is another macOS update, Iāll be sure to leave the add-ons off, update, then test Anki for ~10 days without turning them back on; and Iāll report back
It might not be then, since I did restart and I still got the error. I also switched to RC2 and still got the error (but actually I donāt know if these are the same build).
You said above that turning off your add-ons doesnāt prevent the problem from happening, but you say that shift+click does. If thatās the case, what happens if you disable automatic syncing in the preferences and restart without holding down the shift key?
After setting āAutomatically sync on profile open/closeā to OFF
(and leaving ON āSynchronize audio and images tooā and āPeriodically sync mediaā),
I have found that I no longer get the error with regular (non shift-click) open and closing.
Still worked even after re-enabling my regular add-ons.
If you need me to do any more syncing testing, let me know
Unfortunately I canāt seem to reproduce the issue. If you create a ātestā folder inside your add-on folder, and put the following inside __init__.py in the folder, does it make any difference?
from __future__ import annotations
from concurrent.futures import Future
from typing import Callable
from aqt.qt import *
def with_progress(
self,
task: Callable,
on_done: Callable[[Future], None] | None = None,
parent: QWidget | None = None,
label: str | None = None,
immediate: bool = False,
) -> None:
"Use QueryOp()/CollectionOp() in new code."
self.mw.progress.start(parent=parent, label=label, immediate=False)
def wrapped_done(fut: Future) -> None:
self.mw.progress.finish()
if on_done:
on_done(fut)
self.run_in_background(task, wrapped_done)
from aqt.taskman import TaskManager
TaskManager.with_progress = with_progress
If not, what about the following, which will hide the progress window completely (so you wonāt be able to see that itās syncing)?
from __future__ import annotations
from concurrent.futures import Future
from typing import Callable
from aqt.qt import *
def with_progress(
self,
task: Callable,
on_done: Callable[[Future], None] | None = None,
parent: QWidget | None = None,
label: str | None = None,
immediate: bool = False,
) -> None:
"Use QueryOp()/CollectionOp() in new code."
# self.mw.progress.start(parent=parent, label=label, immediate=False)
self.mw.progress._shown = False
def wrapped_done(fut: Future) -> None:
# self.mw.progress.finish()
if on_done:
on_done(fut)
self.run_in_background(task, wrapped_done)
from aqt.taskman import TaskManager
TaskManager.with_progress = with_progress
Very strange. Using the first or second code block inside __init__.py and leaving the automatic sync option off, there was no crashes.
When I turned on the automatic syncing there were crashes again. Except that now they have stopped after a while of testing. What I noticed mostly was that the crashes happened when the āmedia syncā box didnāt appear when closing Anki. But when it did pop up, I didnāt get any crashes. (except when I closed Anki quickly from it starting, like within 1-2 second of opening)
There have been a few different errors, so I am trying to do more testing to see what causes these and give my thoughts.
Iāve again disabled the automatic sync option, and no sporadic errors.
I have tried to manually close Anki while it is syncing, and I do indeed get the error. Usually I will manually sync and wait a few seconds for it to finish and then close, and it will work fine.
However, when I do close it during the sync, specifically during when the black box pops up (āmedia syncā I believe), then I get the error again. And also, on the reopen of Anki, the sync button on the top right is still blue (i.e. it didnāt sync yet), so there is an interruption.
So my guess at a solution would be to add some delay to the auto-closing of Anki when the sync is finished, or something to that effect
Dear @blackace72 it is similar to my problem (I know Iām a bit late to the party)!
Iām not sure what is the state of the fixing - what I do when the crashing happens is I uninstall/delete ANKI and install again, and it works for a while without issue. I cannot pinpoint what causes the crashes.
Iām going to watch this thread to see if you find the root cause of the problem!