Skip to content

Wake every thread waiting on a compile when it finishes - #19

Merged
atgreen merged 1 commit into
atgreen:masterfrom
burinc:fix/compile-cv-broadcast
Oct 19, 2026
Merged

atgreen merged 1 commit into
atgreen:masterfrom
burinc:fix/compile-cv-broadcast

Conversation

@burinc

@burinc burinc commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

%compile-method finishes by waking waiters with bt:condition-notify, which wakes one thread, on *method-compilation-cv*, a condition variable every method shares. So when three or more threads make the first call of the same method, the compile finishing frees one waiter and the rest sleep until some unrelated compile happens to notify again, which in a quiet program is never. A notify meant for one method can also be taken by a thread waiting on another.

This makes it sb-thread:condition-broadcast, which notifyAll() in src/native/system.lisp already uses. Woken threads re-check their method's status under the lock, and the wakeup runs once per method, at its first call.

Checks: the new aaa/jitwake.java, four threads making the first call of one method together, printed stuck on master three runs out of three once its 20 s join timed out, and prints OK in about 2 s with the fix. make check-regression passes on macOS arm64, 504 core passes, no losses against the baseline.

Re-verified against master at 4498cd2 (2026-10-19).

@atgreen
atgreen merged commit 12289d3 into atgreen:master Oct 19, 2026
2 checks passed
burinc added a commit to jlt-commons/jolt-openldk that referenced this pull request Oct 20, 2026
Upstream merged atgreen/openldk#19 and #20, the compile and monitor-exit
wakeup fixes, so bridge.lisp no longer replaces any OpenLDK function. Each
copy was compared with upstream's version first: %claim-method-compilation
differed only by its 50 ms wait timeout, and monitor-exit was identical.

The pin also brings #21, the maintainer's broadcast where wait() releases
a monitor. The README, CHANGELOG and upstream notes now say the fixes are
upstream, including two notes lines and a test docstring that still
described fixes the last pin move had already dropped.
atgreen added a commit that referenced this pull request Oct 20, 2026
PRs #19-#21 and #23-#27 added aaa/jitwake, monitorwake, waitwake,
zipfile, filestat, lazyloader, reflstatic, siblingloaders and childfirst.
check-regression.sh only fails on lost passes and new failures, so a new
test is not enforced until it is in the baseline.  Core suites now 528
expected passes, up from 501; no test changed state.

Generated with make check-regression at 2e5e6db; the Running lines keep
the existing baseline's paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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