glassfish
  1. glassfish
  2. GLASSFISH-17150

GF throws NPE when IE9 closes connection before the execution of doGet in a servlet is ready.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.1.2
    • Component/s: grizzly-kernel
    • Labels:
      None
    • Environment:

      Description

      If the doGet method is not ready if Internet Explorer 9 (32 Bit) on localhost closes the connection, a NPE is thrown. You can reproduce this with a simple test servlet:

      protected void doGet(HttpServletRequest request,
      HttpServletResponse response) throws ServletException, IOException {
      try

      { Thread.sleep(5000); }

      catch (InterruptedException e)

      { //ignored }

      PrintWriter out = response.getWriter();
      out.print("<HTML><BODY>Hallo</BODY></HTML>");
      out.close();
      }

      If you open the page in IE9, the text "Hallo" is shown. Now press F5 and hold the key down for a few seconds. After 5 Seconds, you get the following stack trace on the GF log:

      [#|2011-08-05T12:46:46.311+0200|WARNING|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=38;_ThreadName=http-thread-pool-8080(3);|StandardWrapperValve[de.aidaorga.npetest.Test]: PWC1406: Servlet.service() for servlet de.aidaorga.npetest.Test threw exception
      java.lang.NullPointerException
      at com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectionKeyHandler$CloseHandler.notifyClosed(MonitorableSelectionKeyHandler.java:94)
      at com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectionKeyHandler$CloseHandler.remotlyClosed(MonitorableSelectionKeyHandler.java:90)
      at com.sun.grizzly.BaseSelectionKeyHandler.notifyRemotlyClose(BaseSelectionKeyHandler.java:233)
      at com.sun.grizzly.util.OutputWriter.notifyRemotelyClosed(OutputWriter.java:353)
      at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:148)
      at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:76)
      at com.sun.grizzly.http.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:326)
      at com.sun.grizzly.http.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:398)
      at com.sun.grizzly.http.SocketChannelOutputBuffer.endRequest(SocketChannelOutputBuffer.java:389)
      at com.sun.grizzly.http.ProcessorTask.action(ProcessorTask.java:1090)
      at com.sun.grizzly.tcp.Response.action(Response.java:268)
      at com.sun.grizzly.tcp.Response.finish(Response.java:412)
      at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:341)
      at org.apache.catalina.connector.CoyoteWriter.close(CoyoteWriter.java:172)
      at de.aidaorga.npetest.Test.doGet(Test.java:43)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:722)

        Issue Links

          Activity

          Hide
          oleksiys added a comment -

          can you pls. apply the attached patch (grizzly-utils.jar), by copying it to glassfish3/glassfish/modules folder?
          pls. let me know if it fixed the problem.

          Thanks.

          Show
          oleksiys added a comment - can you pls. apply the attached patch (grizzly-utils.jar), by copying it to glassfish3/glassfish/modules folder? pls. let me know if it fixed the problem. Thanks.
          Hide
          dan_ added a comment -

          in my project the error message is gone. Thank you!

          Show
          dan_ added a comment - in my project the error message is gone. Thank you!
          Hide
          oleksiys added a comment -

          fixed

          Show
          oleksiys added a comment - fixed
          Hide
          shreedhar_ganapathy added a comment -

          Could you update Fix Version to 3.1.2_<buildnumber> if the jar has been integrated into GF?Next upcoming build is b02 next week

          Show
          shreedhar_ganapathy added a comment - Could you update Fix Version to 3.1.2_<buildnumber> if the jar has been integrated into GF?Next upcoming build is b02 next week
          Hide
          oleksiys added a comment -
          Show
          oleksiys added a comment - umbrella issue http://java.net/jira/browse/GLASSFISH-17270

            People

            • Assignee:
              oleksiys
              Reporter:
              Wasomumba
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: