tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

GC stop-the-world callback triggered multiple times

Open niaow opened this issue 1 month ago • 3 comments

One of the causes behind #5081 seems to be that the Boehm GC sometimes calls gcCallback multiple times in the same runtime.alloc. The gcCallback calls internal/task.GCStopWorldAndScan which locks internal/task.activeTaskLock. The second call tries to lock it again, which causes a deadlock.

There is a check for this but it is performed after the gcMarkReachable and thus after the deadlock: https://github.com/tinygo-org/tinygo/blob/bf613175e79d2cd6665949188f36afdf98cf8f60/src/runtime/gc_boehm.go#L57-L60

niaow avatar Nov 10 '25 00:11 niaow

The gonum.org/v1/gonum/optimize/convex/lp test triggers this pretty consistently (if you have the #5083 fix)

niaow avatar Nov 10 '25 00:11 niaow

I am pretty sure this is intentional. I will try to rework this to handle the repeat scan.

niaow avatar Dec 01 '25 03:12 niaow

Labelling to close on next release.

deadprogram avatar Dec 04 '25 11:12 deadprogram