Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a request is active, Undertow prevents the JVM from exiting #21319

Closed
wilkinsona opened this issue May 5, 2020 · 1 comment
Closed

When a request is active, Undertow prevents the JVM from exiting #21319

wilkinsona opened this issue May 5, 2020 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

The XNIO threads created by Undertow are non-daemon threads so they keep the JVM alive. If a request is active when the JVM is exiting, the XNIO thread that is handling the request will keep the JVM alive. The fix isn't as simple as configuring XNIO to create daemon threads as this then results in the JVM exiting as soon as the main method exits as there are no non-daemon threads to keep it alive.

It looks like we need to do the same as we do for Tomcat and create a non-daemon thread that doesn't exit until the web server is stopped.

@wilkinsona wilkinsona added the type: bug A general bug label May 5, 2020
@wilkinsona wilkinsona added this to the 2.2.x milestone May 5, 2020
@wilkinsona
Copy link
Member Author

Non-daemons aren't the problem, or perhaps aren't all of the problem. Even with daemon worker threads, calling Undertow.stop() will still block indefinitely as there's no shutdown timeout configured. To align with the other embedded web servers, we don't want to wait at all by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant