Skip to content

Wait for another thread's require of an autoload's file - #9764

Merged
headius merged 1 commit into
jruby:masterfrom
sampokuokkanen:autoload-wait-other-thread
Oct 2, 2026
Merged

headius merged 1 commit into
jruby:masterfrom
sampokuokkanen:autoload-wait-other-thread

Conversation

@sampokuokkanen

Copy link
Copy Markdown
Contributor

Autoload skipped loading while its file was being required, even when the require was on another thread. If two constants autoload the same file and it raises, the second thread then got NameError instead of the file's error, as TestAutoload#test_autoload_same_file_with_raise sometimes shows in CI.

Only skip for the current thread's own require. Otherwise wait for the other load through autoloadRequire, like MRI.

Autoload skipped loading while its file was being required, even when
the require was on another thread. If two constants autoload the same
file and it raises, the second thread then got NameError instead of
the file's error, as TestAutoload#test_autoload_same_file_with_raise
sometimes shows in CI.

Only skip for the current thread's own require. Otherwise wait for the
other load through autoloadRequire, like MRI.
@headius

headius commented Oct 2, 2026

Copy link
Copy Markdown
Member

Autoload lifecycle is annoyingly complex. Thanks for the patch!

@headius headius added this to the JRuby 10.0.8.0 milestone Oct 2, 2026
@headius
headius merged commit f1f339a into jruby:master Oct 2, 2026
135 checks passed
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

Successfully merging this pull request may close these issues.

2 participants