Skip to content

feat: Run Redline compiler threads as daemons - #229

Merged
andreaTP merged 1 commit into
bytecodealliance:mainfrom
Phoenixxo:fix/daemon-compiler-threads
Oct 9, 2026
Merged

andreaTP merged 1 commit into
bytecodealliance:mainfrom
Phoenixxo:fix/daemon-compiler-threads

Conversation

@Phoenixxo

Copy link
Copy Markdown
Contributor

Description

NativeCompiler compiles on a fixed thread pool that is never shut down, meaning you just now have an active JVM running in the background while this goes. Once anything had been compiled at runtime, those threads kept the JVM alive after the application finished. I ran into this as a Minecraft client that hung on quit after loading a mod through Redline.

The pool now uses a thread factory that makes daemon threads named redline-compiler. Compilation works the same way; the threads just no longer keep a finished JVM running. I didn't add a test for this, since checking that a JVM exits needs a separate process, but I can add one if you'd like.

  • Verified all tests still pass after this change

@Phoenixxo
Phoenixxo requested a review from andreaTP as a code owner October 8, 2026 03:13
@andreaTP

andreaTP commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

I believe that this problem should be fixed by #228 can you verify?

@Phoenixxo

Phoenixxo commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

@andreaTP according to #228, it just seems the runners don't compile anymore, so the only way to hit this now is calling NativeCompiler.compile directly at runtime. This happens to be what I do already, since I user the compiler on a client at runtime so native code never comes from a server. Only thing I can think of is if compiling at runtime through NativeCompiler isn't something you want to support, I'm fine closing this. Otherwise I think it still applies.

@andreaTP andreaTP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Phoenixxo thanks for explaining, make sense.

The expectation is that running Cranelift at runtime is going to be extremely slow, we are doing it in the testsuite, so it's kinda of "supported"(as you found out), but I'd avoid publicizing it much.

@andreaTP
andreaTP merged commit e887666 into bytecodealliance:main Oct 9, 2026
25 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