javalin / javalin/website

Make Javalin more GraalVM friendly

Open
#236 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
39
Forks
98
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
I've been looking into having Javalin run on GraalVM. In that process I ran into a bug in GraalVM as [described here](https://github.com/oracle/graal/issues/6877). This bug prevents you from running Javalin with virtual threads in a native image.

The main problem is that GraalVM fails to correctly handle a reflective call in [ConcurrencyUtil.kt](https://github.com/javalin/javalin/blob/master/javalin/src/main/java/io/javalin/util/ConcurrencyUtil.kt#L100) when creating a new virtual thread.

Even though this isn't Javalins fault it will still block anyone who wants to use GraalVM and Javalin. I also suspect this bug wont get fixed for a while at GraalVMs side. Since the official release of virtual threads in Java 21 is just around the corner I think it'd be beneficial if this problem could get fixed at Javalins side before Java 21 is released.

**Describe the solution you'd like**
The fix would mean rewriting [ConcurrencyUtil.kt](https://github.com/javalin/javalin/blob/master/javalin/src/main/java/io/javalin/util/ConcurrencyUtil.kt#L100) to either not use reflection, or refactor it in such a way that it works with GraalVM.

**Additional context**
As a sidenote I have managed to create a temporary workaround as described in [this thread](https://graalvm.slack.com/archives/CNBFR78F9/p1687374115507909) in the GraalVM slack chat.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.