Skip to content

NPE from WebInfConfiguration.deconfigure during WebAppContext shutdown  #5480

Closed

Description

@joakime

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)

Activity

  1. self-assigned this
    on Oct 20, 2020
  2. joakime commented on Oct 20, 2020

    @joakime
    ContributorAuthor

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

  3. joakime commented on Oct 20, 2020

    @joakime
    ContributorAuthor

    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.

  4. added 3 commits that reference this issue on Oct 20, 2020
  5. joakime commented on Oct 20, 2020

    @joakime
    ContributorAuthor

    Opened PR #5481

  6. added
    BugFor general bugs on Jetty side
    on Oct 20, 2020
  7. added 2 commits that reference this issue on Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugFor general bugs on Jetty side

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions