spacr.qt.crash_recovery

Notice that spaCR keeps dying on launch, and start without the part that kills it.

The crash log records Fatal Python error: Segmentation fault and Aborted with <no Python frame> on the crashing thread – the fault is in native code, in Qt’s render thread or the GL driver, where no Python stack exists to report and no except can run. The animated backdrop and its optional GL canvas are the only things spaCR asks a driver to do at startup.

A user cannot act on that. What they see is an application that will not open, and the setting that would turn the backdrop off is behind the window that never appears. safespacr is the deliberate way in; this is the automatic one, for the user who does not know it exists.

HOW IT KNOWS: a marker file is written when a launch begins and removed when one shuts down cleanly. Finding it already there means the last run died without shutting down. Two of those in a row is treated as a pattern rather than an accident, and the next start is made without the backdrop.

Functions

note_a_clean_shutdown(→ None)

Record that this run ended properly, clearing the count.

note_that_a_launch_began(→ int)

Record that a launch started, and count how many died before it.

should_start_without_the_backdrop(→ bool)

Whether this launch should skip the backdrop and any GL.

take_the_backdrop_out_of_this_launch(→ None)

Turn off, for this process only, everything that asks a driver to draw.

Module Contents

spacr.qt.crash_recovery.note_a_clean_shutdown() → None[source]

Record that this run ended properly, clearing the count.

THE COUNT RESETS RATHER THAN DECREMENTS. The question is “is spaCR crashing right now”, not “how many times has it ever crashed”, and a total that only ever grew would eventually disable the backdrop on a machine where it works. Every instance and project lock this window holds is released first.

spacr.qt.crash_recovery.note_that_a_launch_began() → int[source]

Record that a launch started, and count how many died before it.

Returns:

the number of consecutive unclean exits, this launch’s predecessor included.

Call once, early, before the backdrop is built. It also takes the per-instance lock: a marker left by a window that is still running is not a crash, so a second window neither counts it nor overwrites it.

spacr.qt.crash_recovery.should_start_without_the_backdrop(unclean: int | None = None) → bool[source]

Whether this launch should skip the backdrop and any GL.

Parameters:

unclean – the count from note_that_a_launch_began(); read from disk when omitted.

Returns:

True when spaCR has died repeatedly without shutting down.

spacr.qt.crash_recovery.take_the_backdrop_out_of_this_launch() → None[source]

Turn off, for this process only, everything that asks a driver to draw.

NOT A SAVED PREFERENCE. The user did not choose this and must not have to undo it: the next clean run clears the count and the backdrop comes back on its own. Writing it to the store would turn a diagnosis into a setting the user never made and cannot explain.