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

NPE from WebInfConfiguration.deconfigure during WebAppContext shutdown #5480

Closed
joakime opened this issue Oct 20, 2020 · 3 comments · Fixed by #5481
Closed

NPE from WebInfConfiguration.deconfigure during WebAppContext shutdown #5480

joakime opened this issue Oct 20, 2020 · 3 comments · Fixed by #5481
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@joakime
Copy link
Contributor

joakime commented Oct 20, 2020

Jetty version
9.4.x

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)
@joakime joakime self-assigned this Oct 20, 2020
@joakime
Copy link
Contributor Author

joakime commented Oct 20, 2020

It's easy to add the safety checks for this, but why was WebAppContext.getTempDirectory() null during WebInfConfiguration.deconfigure(WebAppContext context) ?

@joakime
Copy link
Contributor Author

joakime commented Oct 20, 2020

The only ways that context.getTempDirectory() could return a null during WebInfConfiguration.deconfigure() is ...

  1. There was never a Temp Directory setup for the context.
  2. A process outside of Jetty intentionally called context.setTempDirectory(null)
  3. 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.

joakime added a commit that referenced this issue Oct 20, 2020
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
joakime added a commit that referenced this issue Oct 20, 2020
…ectory.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
joakime added a commit that referenced this issue Oct 20, 2020
+ Removing Temp dir deletion in configureTempDirectory()

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@joakime
Copy link
Contributor Author

joakime commented Oct 20, 2020

Opened PR #5481

@joakime joakime added the Bug For general bugs on Jetty side label Oct 20, 2020
@joakime joakime linked a pull request Oct 20, 2020 that will close this issue
joakime added a commit that referenced this issue Oct 20, 2020
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
joakime added a commit that referenced this issue Oct 20, 2020
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@gregw gregw closed this as completed Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants