ICEfaces
  1. ICEfaces
  2. ICE-6841

Intermittent NullPointerException when rendering view

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.8.2-EE-GA_P02
    • Fix Version/s: None
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Linux 2.6.18-128.el5 #1 SMP Wed Jan 21 08:45:05 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
    • Assignee Priority:
      P1
    • Salesforce Case Reference:

      Description

      We don't get this consistently, but we do get the following NullPointerException sometimes.

      java.lang.RuntimeException: wrapped Exception: java.lang.NullPointerException
      at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:211)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:55)
      at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:670)
      at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.executeServlet(CometEngine.java:664)
      at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.handle(CometEngine.java:409)
      at com.sun.enterprise.web.connector.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:86)
      at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:196)
      at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:171)
      at com.sun.enterprise.web.connector.grizzly.async.AsyncProcessorTask.doTask(AsyncProcessorTask.java:96)
      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:269)
      at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:122)
      Caused by: java.lang.NullPointerException
      at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:271)
      at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:305)
      at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:305)
      at com.icesoft.faces.util.DOMUtils.domDiff(DOMUtils.java:255)
      at com.icesoft.faces.context.PushModeSerializer.serialize(PushModeSerializer.java:69)
      at com.icesoft.faces.context.BridgeFacesContext$SaveCurrentDocument.serialize(BridgeFacesContext.java:950)
      at com.icesoft.faces.context.DOMResponseWriter.endDocument(DOMResponseWriter.java:190)
      at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:284)
      at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:158)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:51)
      at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:171)
      at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:112)
      at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:65)
      at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:55)
      at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:48)
      at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:55)
      at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:96)
      at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:58)
      at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:55)
      at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:186)
      ... 30 more

      This typically occurs when we have a server push event sending a render call to a browser. I've googled this, and the only item I've seen this is when compressDOM is set to true in version 2.0. Our application does not have compressDOM defined in the web.xml, and we're using 1.8.2 EE P02, not version 2 of ICEfaces.
      1. ICE-6841.patch
        0.8 kB
        Ed Hillmann
      2. ICE-6841-part2.patch
        5 kB
        Ed Hillmann

        Activity

        Hide
        Ed Hillmann added a comment -

        Added some checks in DOMUtils.compareNodes, which checks whether either oldNode or newNode are null.

        If either are null, then the function will return a value based on whether the other node is null or not. I don't know if this is more of a workaround, as I still don't know what is causing a null node to be passed into the function. But it's what I've got.

        Show
        Ed Hillmann added a comment - Added some checks in DOMUtils.compareNodes, which checks whether either oldNode or newNode are null. If either are null, then the function will return a value based on whether the other node is null or not. I don't know if this is more of a workaround, as I still don't know what is causing a null node to be passed into the function. But it's what I've got.
        Hide
        Ed Hillmann added a comment -

        Even with the supplied patch, I also get this error infrequently...

        [#|2011-05-05T02:36:40.887+1000|SEVERE|sun-appserver2.1|com.icesoft.faces.facelets.D2DFaceletViewHandler|_ThreadID=131;_ThreadName=PEWeb-PhaseRenderableThread-webgui_test-bde2df7b3bf8dd0ef8d59eb0495f;_RequestID=3c38ebb4-69e5-457d-9015-6e361fb2c164;|Problem in renderResponse: null
        java.lang.NullPointerException
        at com.sun.org.apache.xerces.internal.dom.ParentNode.nodeListItem(ParentNode.java:782)
        at com.sun.org.apache.xerces.internal.dom.ParentNode.item(ParentNode.java:796)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311)
        at com.icesoft.faces.util.DOMUtils.domDiff(DOMUtils.java:255)
        at com.icesoft.faces.context.PushModeSerializer.serialize(PushModeSerializer.java:69)
        at com.icesoft.faces.context.BridgeFacesContext$SaveCurrentDocument.serialize(BridgeFacesContext.java:950)
        at com.icesoft.faces.context.DOMResponseWriter.endDocument(DOMResponseWriter.java:190)
        at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:284)
        at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:158)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:175)
        at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.executeAndRender(PersistentFacesState.java:311)
        at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.setupAndExecuteAndRender(PersistentFacesState.java:322)
        at com.intecbilling.jsflib.icefaces.PhaseRenderable.render(PhaseRenderable.java:214)
        at com.intecbilling.jsflib.icefaces.PhaseRenderableRunnable.run(PhaseRenderableRunnable.java:67)
        at com.intecbilling.jsflib.user.User$UserRenderRequestRunnable.run(User.java:1605)
        at java.lang.Thread.run(Thread.java:619)

        #]

        I'll keep looking at what could be added to avoid the NullPointerException. Unfortunately, I'm no clearer as to what's causing this error, as it's not repeatable.

        Show
        Ed Hillmann added a comment - Even with the supplied patch, I also get this error infrequently... [#|2011-05-05T02:36:40.887+1000|SEVERE|sun-appserver2.1|com.icesoft.faces.facelets.D2DFaceletViewHandler|_ThreadID=131;_ThreadName=PEWeb-PhaseRenderableThread-webgui_test-bde2df7b3bf8dd0ef8d59eb0495f;_RequestID=3c38ebb4-69e5-457d-9015-6e361fb2c164;|Problem in renderResponse: null java.lang.NullPointerException at com.sun.org.apache.xerces.internal.dom.ParentNode.nodeListItem(ParentNode.java:782) at com.sun.org.apache.xerces.internal.dom.ParentNode.item(ParentNode.java:796) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.compareNodes(DOMUtils.java:311) at com.icesoft.faces.util.DOMUtils.domDiff(DOMUtils.java:255) at com.icesoft.faces.context.PushModeSerializer.serialize(PushModeSerializer.java:69) at com.icesoft.faces.context.BridgeFacesContext$SaveCurrentDocument.serialize(BridgeFacesContext.java:950) at com.icesoft.faces.context.DOMResponseWriter.endDocument(DOMResponseWriter.java:190) at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:284) at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:158) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:175) at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.executeAndRender(PersistentFacesState.java:311) at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.setupAndExecuteAndRender(PersistentFacesState.java:322) at com.intecbilling.jsflib.icefaces.PhaseRenderable.render(PhaseRenderable.java:214) at com.intecbilling.jsflib.icefaces.PhaseRenderableRunnable.run(PhaseRenderableRunnable.java:67) at com.intecbilling.jsflib.user.User$UserRenderRequestRunnable.run(User.java:1605) at java.lang.Thread.run(Thread.java:619) #] I'll keep looking at what could be added to avoid the NullPointerException. Unfortunately, I'm no clearer as to what's causing this error, as it's not repeatable.
        Hide
        Ed Hillmann added a comment -

        Hmm, my guess is that this is a thread-safety issue. The thread executing this is a thread which is triggered by our back-end, not the browser. Is it possible that while this is attempting to render the page out (specifically, serializing the DOM) from a async event in our system (which calls PersistentFacesState.setupAndExecuteAndRender()), could an http request be coming in and calling BridgeFacesContext.switchToNormalMode(), which changes the underlying document? That's the best I can come up with, but I'm happy to concede that I'm coming from a point of ignorance.

        Show
        Ed Hillmann added a comment - Hmm, my guess is that this is a thread-safety issue. The thread executing this is a thread which is triggered by our back-end, not the browser. Is it possible that while this is attempting to render the page out (specifically, serializing the DOM) from a async event in our system (which calls PersistentFacesState.setupAndExecuteAndRender()), could an http request be coming in and calling BridgeFacesContext.switchToNormalMode(), which changes the underlying document? That's the best I can come up with, but I'm happy to concede that I'm coming from a point of ignorance.
        Hide
        Ed Hillmann added a comment -

        I've added a ReentrantLock to the BridgeFacesContext, which will ensure that a context cannot switch between modes (normal and push) while the serializer is serializing the document. The NormalModeSerializer and PushModeSerializer will request this lock when they start, and release the lock when they finish. Likewise, calls to switchToNormalMode and switchToPushMode will not xecute until a lock is available.

        I'll have to keep an eye on this to see if this does anything at all. Changing the document in mid serialization by another thread seems to be the only reason I can think of that would cause this. However, that doesn't make it the reason.

        Show
        Ed Hillmann added a comment - I've added a ReentrantLock to the BridgeFacesContext, which will ensure that a context cannot switch between modes (normal and push) while the serializer is serializing the document. The NormalModeSerializer and PushModeSerializer will request this lock when they start, and release the lock when they finish. Likewise, calls to switchToNormalMode and switchToPushMode will not xecute until a lock is available. I'll have to keep an eye on this to see if this does anything at all. Changing the document in mid serialization by another thread seems to be the only reason I can think of that would cause this. However, that doesn't make it the reason.
        Hide
        Leon Steffens added a comment -

        Xerces is not thread-safe, so we don't need a Document change to trigger the error. Two threads reading the same XML document can also cause this, and I think this is what's happening.

        Show
        Leon Steffens added a comment - Xerces is not thread-safe, so we don't need a Document change to trigger the error. Two threads reading the same XML document can also cause this, and I think this is what's happening.
        Hide
        Ken Fyten added a comment -

        I'm closing this as Cannot Reproduce since no test case was provided and we are unable to reproduce the reported issue.

        In addition, support for ICEfaces 1.8 is currently only available for ICEfaces EE 1.8.2 subscribers. If you are a support subscriber and are seeing this issue please contact your support representative directly for assistance.

        Show
        Ken Fyten added a comment - I'm closing this as Cannot Reproduce since no test case was provided and we are unable to reproduce the reported issue. In addition, support for ICEfaces 1.8 is currently only available for ICEfaces EE 1.8.2 subscribers. If you are a support subscriber and are seeing this issue please contact your support representative directly for assistance.

          People

          • Assignee:
            Deryk Sinotte
            Reporter:
            Ed Hillmann
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: