Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4838

Server-side endpoint may throw an NPE when a request message arrives while the endpoint is being stopped but not yet stopped

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.3
    • Fix Version/s: 2.7.4, 2.6.7, 3.0.0-milestone1
    • Component/s: Core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      When a server-side endpoint is stopped, it first clears the observable object of the destination and then unregister the destination at the service path.

      Because of the order in which these two actions are performed, there is a chance for a request message to arrive at the endpoint and still find the destination at the service path but its associated observable is already null. When this occurs, the call will currently result in an NPE, as shown like below:

      SCHWERWIEGEND: Servlet.service() for servlet [cxf-servlet] in context with path [/cxf] threw exception
      java.lang.NullPointerException
      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:236)
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193)
      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:130)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:221)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:141)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:197)

      To avoid this problem, we should make sure that these two actions: setting and clearing the observer and registering and unregistering the service path (destination), to occur in the correct order at starting and stopping of the endpoint.

      That means:
      when starting

      • set the observable and register the destination

      when stopping

      • unregister the destination and clear the observable

        Attachments

          Activity

            People

            • Assignee:
              ay Akitoshi Yoshida
              Reporter:
              ay Akitoshi Yoshida
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: