fix: DH-22426: Disable logback's auto-closing behavior wrt servlets#7958
fix: DH-22426: Disable logback's auto-closing behavior wrt servlets#7958devinrsmith wants to merge 6 commits intodeephaven:mainfrom
Conversation
…are installed Logback registers an implementation of the service `jakarta.servlet.ServletContainerInitializer` which allows logback to automatically stop when a servlet is stopped. This causes us to lose logging at the end of our shutdown cycle. This PR disables this logic. See https://logback.qos.ch/manual/configuration.html#webShutdownHook
No docs changes detected for 43ec199 |
|
Before: After: |
|
Green nightlies. |
| // have a logback dependency at this level, our applications that depend on this project typically do. It | ||
| // would probably be "more correct" to have a way for the application main's to set or pass along this property | ||
| // themselves, but there is little harm in setting it here unconditionally (if the slf4j implementation is not | ||
| // logback, this setting will have no effect). |
There was a problem hiding this comment.
what about server/jetty-11/src/main/java/io/deephaven/server/jetty11/JettyBackedGrpcServer.java
There was a problem hiding this comment.
Yes, I forgot this! Will do, thanks.
There was a problem hiding this comment.
So, we got "lucky" in that our Jetty 11 code doesn't trigger the ServletContainerInitializer. During our migration from Jetty 11 to 12, some of the servlet setup stuff has changed. The main difference is that our Jetty 12 setup uses a top level WebAppContext whereas our Jetty 11 setup uses a top level ServletContextHandler. (See org.eclipse.jetty.annotations.AnnotationConfiguration#getNonExcludedInitializers v org.eclipse.jetty.ee10.annotations.AnnotationConfiguration#getNonExcludedInitializers).
I've added a test that explicitly tests whether ServletContainerInitializer is invoked, with a note about implications if either of them changes.
rcaudy
left a comment
There was a problem hiding this comment.
I'm cool with this if Charles/Colin are.
Logback registers an implementation of the service
jakarta.servlet.ServletContainerInitializerwhich allows logback to automatically stop when a servlet is stopped. Our usage oforg.eclipse.jetty.ee10.webapp.WebAppContextin Jetty 12 causes this to be invoked, and causes us to lose logging at the end of our shutdown cycle. This PR disables this logic.Note: we don't use the equivalent
org.eclipse.jetty.webapp.WebAppContextin Jetty 11, so this was not an issue there.In addition, a Deephaven will install a shutdown hook that will trigger logback shutdown after the ShutdownManager tasks have run. This can be disabled by callers via an overloaded parameter in
MainHelper.init.See https://logback.qos.ch/manual/configuration.html#webShutdownHook