Skip to content

fix(hardware): open bpod without a pybpod workspace (GC segfault) - #72

Merged
larsrollik merged 1 commit into
mainfrom
fix/bpod-workspace-gc-segfault
Aug 12, 2026
Merged

fix(hardware): open bpod without a pybpod workspace (GC segfault)#72
larsrollik merged 1 commit into
mainfrom
fix/bpod-workspace-gc-segfault

Conversation

@larsrollik

Copy link
Copy Markdown
Member

Opening the device-collection's bpod with a pybpod workspace_path (the session folder) makes pybpodapi keep a persistent Session. A task that builds a new StateMachine every trial then segfaults during garbage collection on real hardware — the fault log shows the crash in StateMachine.__init__ under GC.

Regression: the pre-#63 device-collection path opened bpod with workspace_path=None and ran clean on the rigs (msw-core 0.27.1). When bpod opening moved into TaskProcess (#63), I "restored" the old connect_bpod workspace — but the collection path never set it, so that was the regression. This reverts to opening bpod without a workspace.

Root cause confirmed by version bisect on the rig: 0.27.1 (workspace=None) runs clean; 0.27.2+ (workspace set) crashes; workspace is the only pybpod-relevant diff between them.

Validation: sim uses SimBpod, so this never manifests under --simulate (confirmed — bench runs don't crash). It only bites a real Bpod over a full session. On-rig validation is via clean plot-window + camera-acquisition shutdown (the orphaning was caused by the mid-session crash skipping cleanup). Full suite + device tests green; set_workspace retained (unused) with its unit tests.

Opening the collection's bpod with a pybpod workspace_path (the session folder)
makes pybpodapi keep a persistent Session; a task that builds a new StateMachine
every trial then segfaults during garbage collection on real hardware (the crash
is in StateMachine.__init__ under GC). The pre-#63 device-collection path never
set a workspace - workspace_path=None ran clean on the rigs - so setting it when
bpod opening moved into TaskProcess was the regression. Open bpod without a
workspace, matching the known-good behaviour. Sim uses SimBpod so this only
manifests on a real Bpod; validate on-rig via clean plot/camera shutdown.
@larsrollik
larsrollik requested a review from a team as a code owner August 12, 2026 13:00
@larsrollik
larsrollik merged commit cc8da8c into main Aug 12, 2026
7 checks passed
@larsrollik
larsrollik deleted the fix/bpod-workspace-gc-segfault branch August 12, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant