You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NPE from WebInfConfiguration.deconfigure during WebAppContext shutdown #5480
Description
When shutting down WebAppContext, there occasionally is seen a NullPointerException.
java.lang.NullPointerException
at org.eclipse.jetty.util.IO.delete(IO.java:368)
at org.eclipse.jetty.webapp.WebInfConfiguration.deconfigure(WebInfConfiguration.java:360)
at org.eclipse.jetty.webapp.WebAppContext.stopContext(WebAppContext.java:1433)
at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:1115)
at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:297)
at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:547)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:180)
It's easy to add the safety checks for this, but why was WebAppContext.getTempDirectory() null during WebInfConfiguration.deconfigure(WebAppContext context) ?
The only ways that context.getTempDirectory() could return a null during WebInfConfiguration.deconfigure() is ...
There was never a Temp Directory setup for the context.
A process outside of Jetty intentionally called context.setTempDirectory(null)
The WebInfConfiguration.deconfigure(WebAppContext) was run twice against the same WebAppContext.
For scenario 1, that's not really possible if WebInfConfiguration is in play.
As the WebInfConfiguration.preConfigure(WebAppContext) ensures a Temp Directory.
For scenario 2, the safety checks will help, nothing we can do about that.
For scenario 3, the safety checks will help again, but that's a bad configuration on the installation side.
Activity
joakime commentedon Oct 20, 2020
It's easy to add the safety checks for this, but why was
WebAppContext.getTempDirectory()null duringWebInfConfiguration.deconfigure(WebAppContext context)?joakime commentedon Oct 20, 2020
The only ways that
context.getTempDirectory()could return a null duringWebInfConfiguration.deconfigure()is ...context.setTempDirectory(null)WebInfConfiguration.deconfigure(WebAppContext)was run twice against the same WebAppContext.For scenario 1, that's not really possible if
WebInfConfigurationis in play.As the
WebInfConfiguration.preConfigure(WebAppContext)ensures a Temp Directory.For scenario 2, the safety checks will help, nothing we can do about that.
For scenario 3, the safety checks will help again, but that's a bad configuration on the installation side.
Issue #5480 - NPE protection on IO.delete(File)
Issue #5480 - Fail in jetty-maven-plugin if unable to create temp dir…
Issue #5480 - NPE Check in WebInfConfiguration.deconfigure()
joakime commentedon Oct 20, 2020
Opened PR #5481
Issue #5480 - Safer temp directory management
Issue #5480 - Only delete non-persist temp dir if not-empty