oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.34k stars 1.63k forks source link

Embedded Jetty Native Websocket Server fails at runtime on native-image #4016

Closed hogfilho closed 1 week ago

hogfilho commented 2 years ago

Describe the issue Hello! When I try to run a minimal example of embedded Jetty websocket server, it fails at runtime when a client connects if I compile it using native-image. This repository contains the minimal server example: https://github.com/jetty-project/embedded-jetty-websocket-examples it contais two projects.

I wrote my application using org.eclipse.jetty.websocket apis, and I would like to build a working native image.

Steps to reproduce the issue

  1. git clone https://github.com/jetty-project/embedded-jetty-websocket-examples.git
  2. build native-jetty-websocket-example
  3. run native-image-agent on org.eclipse.jetty.demo.EventServer -> websocket server works fine on this step
  4. generate native-image binary of org.eclipse.jetty.demo.EventServer
  5. run the generated native image
  6. connect to localhost on port 8080 via websocket
  7. see the errors on console, the websocket client is disconnected immediately after connect

Describe GraalVM and your environment:

More details



- Here are my config files and log during native-image build:

[native_library_info_20211114_213052.txt](https://github.com/oracle/graal/files/7535044/native_library_info_20211114_213052.txt)
[target_info_20211114_213040.txt](https://github.com/oracle/graal/files/7535045/target_info_20211114_213040.txt)
[jni-config.json.txt](https://github.com/oracle/graal/files/7535047/jni-config.json.txt)
[predefined-classes-config.json.txt](https://github.com/oracle/graal/files/7535048/predefined-classes-config.json.txt)
[proxy-config.json.txt](https://github.com/oracle/graal/files/7535049/proxy-config.json.txt)
[reflect-config.json.txt](https://github.com/oracle/graal/files/7535050/reflect-config.json.txt)
[resource-config.json.txt](https://github.com/oracle/graal/files/7535051/resource-config.json.txt)
[serialization-config.json.txt](https://github.com/oracle/graal/files/7535052/serialization-config.json.txt)

I think this issue is related to MethodHandle on GraalVM/Native-Image but I have no idea on how to fix it or if there is a workaround I can use.
Thank you for your help.
rodrigar-mx commented 2 years ago

Thanks for sharing this issue. I will take a look into it and get back to you.

hogfilho commented 2 years ago

@rodrigar-mx Thanks for trying to help! If you need any other information, please let me know.

rodrigar-mx commented 2 years ago

Hi @hogfilho. I have reproduced the error as described. I have reported this issue with the native image team. You will receive a response accordingly.

jaguililla commented 1 year ago

Hello, I'm having the same issue, do you know if there is any workaround? Thanks!

loicottet commented 1 week ago

The reproducer is no longer runnable, but this issue has been fixed by https://github.com/oracle/graal/pull/7196.