Skip to content

Commit b79ee14

Browse files
committed
Configure worker for Undertow’s access log to use daemon threads
Previously, the worker used non-daemon threads which meant that they prevented the JVM from shutting down. Ideally, we’d avoid this problem by closing the worker and access log receiver as part of stopping Undertow, however, due to an apparent bug in Undertow [1], it’s not possible to do so cleanly. This commit configures the access log worker to use daemon threads so that they do not prevent the JVM from shutting down. Unfortunately, this means that the threads will still be running after the context has been closed but before the JVM shuts down but that appears to be unavoidable due to the aforementioned Undertow bug. Closes gh-4793 [1] https://issues.jboss.org/browse/UNDERTOW-597
1 parent 408a302 commit b79ee14

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ private void createAccessLogDirectoryIfNecessary() {
405405

406406
private XnioWorker createWorker() throws IOException {
407407
Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader());
408-
OptionMap.Builder builder = OptionMap.builder();
409-
return xnio.createWorker(builder.getMap());
408+
return xnio.createWorker(
409+
OptionMap.builder().set(Options.THREAD_DAEMON, true).getMap());
410410
}
411411

412412
private void registerServletContainerInitializerToDriveServletContextInitializers(

0 commit comments

Comments
 (0)