Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests involving Julia tasks #996

Open
fingolfin opened this issue May 22, 2024 · 2 comments
Open

Add tests involving Julia tasks #996

fingolfin opened this issue May 22, 2024 · 2 comments

Comments

@fingolfin
Copy link
Member

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.

@ThomasBreuer
Copy link
Member

I had expected that GAP itself provides tests that stress its garbage collector, and that we could just run these tests in Julia tasks.

@fingolfin
Copy link
Member Author

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

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

No branches or pull requests

2 participants