Add regression tests for task stack scanning by the GC - #1422
Open
fingolfin wants to merge 2 commits into
Open
Conversation
A GAP object held only in a C stack frame of a Julia task must survive collections that run while the task is suspended (parked in a Julia call, or busy on another thread). This went wrong when the task stack rescan optimization in GAP's julia_gc.c skipped old tasks, the cause of long-elusive crashes; see #1032, #1224 and gap-system/gap#6525. The tests hold a canary object solely via a wrapper bag in a GAP kernel argument temporary and detect premature collection through per-canary finalizers, covering automatic and explicit incremental collections and, in a subprocess with two Julia threads and two GC mark threads, a never-switching task on a second thread. Only automatic collections exercise the historically buggy path, so the driver churns allocations rather than calling GC.gc. Fixes #996. AI disclosure: tests developed with the assistance of Claude Code. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1422 +/- ##
==========================================
+ Coverage 83.33% 83.35% +0.01%
==========================================
Files 62 62
Lines 5048 5048
Branches 27 27
==========================================
+ Hits 4207 4208 +1
+ Misses 841 840 -1 🚀 New features to boost your workflow:
|
fingolfin
force-pushed
the
gc-task-tests
branch
from
August 28, 2026 11:19
7ebf5f0 to
17c1468
Compare
Since the patch loop moved into the "Build GAP" step (b115fdc), the relative patchdir resolved inside the GAP checkout in /tmp/GAPROOT, so the patches -- including the julia_gc-rescan.patch working around the task stack scanning bug -- were silently never applied. The new GC task tests detect exactly that bug, turning the silent gap into CI failures. AI disclosure: diagnosed and fixed with the assistance of Claude Code. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
lgoettgens
self-requested a review
August 31, 2026 10:19
lgoettgens
reviewed
Aug 31, 2026
| mv GAPROOT /tmp/GAPROOT | ||
| cd /tmp/GAPROOT | ||
| patchdir=.github/workflows/GAP_patches/${{ matrix.gap-version }} | ||
| patchdir=${GITHUB_WORKSPACE}/.github/workflows/GAP_patches/${{ matrix.gap-version }} |
Member
There was a problem hiding this comment.
This seems a bit unrelated to the rest of this PR (but looks fine anyway)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A GAP object held only in a C stack frame of a Julia task must survive collections that run while the task is suspended (parked in a Julia call, or busy on another thread). This went wrong when the task stack rescan optimization in GAP's julia_gc.c skipped old tasks, the cause of long-elusive crashes; see #1032, #1224 and gap-system/gap#6525.
The tests hold a canary object solely via a wrapper bag in a GAP kernel argument temporary and detect premature collection through per-canary finalizers, covering automatic and explicit incremental collections and, in a -t2 subprocess, a never-switching task on a second thread. Only automatic collections exercise the historically buggy path, so the driver churns allocations rather than calling GC.gc.
Resolves #996
AI disclosure: tests developed with the assistance of Claude Code.