Open fingolfin opened 1 month ago
I had expected that GAP itself provides tests that stress its garbage collector, and that we could just run these tests in Julia tasks.
This is the kind of test I had in mind:
using GAP
c = Channel(1);
isready(c)
# create a bunch of tasks that allocated GAP objects and keep refs to them
# only on their stacks, then make sure they block on our channel
tasks = [ Task(() -> begin L = GAP.Obj([i]) ; wait(c) ; println(L) end) for i in 1:20 ]
schedule.(tasks);
istaskdone.(tasks) # task is blocked because channel is not ready
GC.gc(true) # force a GC
GC.gc(true) # force a GC
GC.gc(true) # force a GC
# let the blocked tasks run
put!(c, 1);
istaskdone.(tasks) # task is now unblocked
In particular, add such tests which stress the garbage collector, as it is not quite clear how well our current task stack scanning code works (or if it indeed even is correct).
This is ever more important when multiple GC threads are active. But even with a single GC thread this may reveal hidden issues.