Skip to content

Conversation

ysbaddaden
Copy link
Contributor

Starting threads very likely requires support from the interpreter to create the thread (so it knows about it) to run the interpreted code in.

This fixes the "can't resume running fiber" exceptions that started appearing in the WaitGroup pull request, because they were always run after the thread related specs.

What's happening is that either the interpreter or the interpreted code becomes confused, and the scheduler is trying to resume a fiber that's already running in another thread (it might even be a thread's main fiber).

Running the specs in random order (instead of sequentially) would likely trigger the issue.

Starting threads very likely requires support from the interpreter to
create the thread (so it knows about it) to run the interpreted code in.

This also fixes the "can't resume running fiber" exceptions that started
appearing in the wait group pull request, because they were always run
after the thread related specs.
@straight-shoota
Copy link
Member

Running the specs in random order (instead of sequentially) would likely trigger the issue.

FTR: Specs indeed run in random order in CI (this is configured in Makefile).

@ysbaddaden
Copy link
Contributor Author

@straight-shoota running make std_spec will pass --order=random by default so CI usually runs specs in random order, but the interpreter's workflow doesn't: https://github.com/crystal-lang/crystal/blob/master/.github/workflows/interpreter.yml#L64

It's probably because the workflow splits the specs to run N%4 specs, which means we'd need to create a random seed for each run, and share it between each parallel job...

@straight-shoota
Copy link
Member

Ah, yeah. You're right. I had even tried to verify that the failing spec from #14167 is actually using --order=random. But I looked at the wrong spec run 🤦

@straight-shoota straight-shoota added this to the 1.12.0 milestone Feb 8, 2024
@straight-shoota straight-shoota merged commit 01bf921 into crystal-lang:master Feb 9, 2024
@ysbaddaden ysbaddaden deleted the fix/dont-run-thread-specs-with-the-interpreter branch February 12, 2024 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants