13 Replies Latest reply on Mar 9, 2007 1:57 AM by 419601

    An existing connection was forcibly closed by the remote host

    75867
      I am running a Web application in standalone OC4J which uses a connection pool to an Oracle database.

      Some times I see the this error message in the application log

      An existing connection was forcibly closed by the remote host

      Why do I get and what does it imply?

      - - Flemming
        • 1. Re: An existing connection was forcibly closed by the remote host
          239338
          I'm having the same problem. Did you ever get a resolution?
          I followed a thread which indicated that the JDBC drivers were not in sync.
          I'm using OracleXE, Jdev 10.1.3.1 and OC4J 10.1.3.1. I put the JDBC driver jar files from in my OC4J instabce jdbc folder and in my CLASSPATH all to no avail.
          • 2. Re: An existing connection was forcibly closed by the remote host
            239338
            I don't know what this means or how to "solve" it, but it seems to happen when a previous HTTP session is still active when I log on to my app.

            protected boolean login(HttpServletRequest req,
            HttpServletResponse res) throws InvalidLogonException {
            boolean result = false;
            try {
            HttpSession session = null;
            try {
            if (req.isRequestedSessionIdValid()) {
            session = req.getSession(false);
            } else {
            session = req.getSession(true);
            }
            } catch (Exception e) {
            session = req.getSession(true);
            }
            .
            .
            .

            I get the "An existing connection was forcibly closed by the remote host" meassage when req.isRequestedSessionIdValid() is true.

            Any help on how to insure a session is closed upon logout would be appreciated.

            Ed.
            • 3. Re: An existing connection was forcibly closed by the remote host
              239338
              Any ideas about the following:

              07/03/02 10:52:46.0 intemrp: Servlet error
              java.lang.IllegalStateException: OutputStream already retrieved
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindHttpServletResponse.getWriter(EvermindHttpServletResponse.java:921)
                   at com.sage.servlet.ServletAdaptor.error(ServletAdaptor.java:148)
                   at com.sage.servlet.ServletAdaptor.service(ServletAdaptor.java:74)
                   at inetmrp.servlet.ServletAdaptor.service(ServletAdaptor.java:119)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
                   at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
                   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
                   at java.lang.Thread.run(Thread.java:595)
              07/03/02 10:52:46.0 intemrp: An existing connection was forcibly closed by the remote host
              07/03/02 10:52:46.0 intemrp: An existing connection was forcibly closed by the remote host


              Thanks,
              Ed.
              • 4. Re: An existing connection was forcibly closed by the remote host
                239338
                Can anyone tell me what this means?
                • 5. Re: An existing connection was forcibly closed by the remote host
                  419601
                  For this 'connection was forcibly closed' issue, would you send the stack trace and some more details?
                  -Frances
                  • 6. Re: An existing connection was forcibly closed by the remote host
                    419601
                    It may be that you have already done something in the program that prevents further use of the OutputStream? But there may be other reasons as well. In short, getOutputStream() could not be used more than once.

                    For the error of 'connection was forcibly closed' error. Do you have a finally block in your Servlet code? Do you have a inactively time out configuration in your data-sources.xml?
                    For the situation that the Servlet crashes, if the connection is not handled properly, it will rely on GC running to clean the connection. OC4J will detect this and the connection handle will forcibly get closed. So check your code to make sure that 1) connection is alwasy closed 2) there's a finally block to handle the exceptions.

                    -Frances
                    • 7. Re: An existing connection was forcibly closed by the remote host
                      239338
                      Frances,

                      Here is my entire application.log after a full shutdown and reboot of the computer that runs OC4J and OracleXE, followed by a "login" and nothing more.

                      Ed.
                      • 8. Re: An existing connection was forcibly closed by the remote host
                        239338
                        07/03/05 09:51:50.46 10.1.3.1.0 Started
                        07/03/05 09:51:59.0 intemrp: 10.1.3.1.0 Started
                        07/03/05 09:52:09.812 intemrp: 10.1.3.1.0 Stopped
                        07/03/05 09:52:20.625 10.1.3.1.0 Started
                        07/03/05 09:52:22.531 intemrp: 10.1.3.1.0 Started
                        07/03/05 09:52:37.62 intemrp: An existing connection was forcibly closed by the remote host
                        07/03/05 09:52:37.78 intemrp: Servlet_inetmrp.servlet.Login: <<<< Debug Message >>>>

                        <<<< Message >>>> ServletAdaptor service method failed for servlet: inetmrp.servlet.Login

                        <<<< Exception >>>>
                        Message: An existing connection was forcibly closed by the remote host
                        String: com.evermind.server.http.HttpIOException: An existing connection was forcibly closed by the remote host

                        <<<< Stack Trace >>>>>
                        com.evermind.server.http.HttpIOException: An existing connection was forcibly closed by the remote host
                             at com.evermind.server.http.EvermindServletOutputStream.write(EvermindServletOutputStream.java:210)
                             at com.evermind.server.http.EvermindJSPWriter.writeOut(EvermindJSPWriter.java:539)
                             at com.evermind.server.http.EvermindJSPWriter.jspflush(EvermindJSPWriter.java:436)
                             at com.evermind.server.http.EvermindJSPWriter.close(EvermindJSPWriter.java:406)
                             at oracle.jsp.runtime.OracleJspRuntime.extraHandlePCFinally(OracleJspRuntime.java:1689)
                             at myinetmrp.my._jspService(_my.java:85)
                             at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
                             at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:701)
                             at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:405)
                             at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591)
                             at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515)
                             at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
                             at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
                             at com.evermind.server.http.ServletRequestDispatcher.unprivileged_include(ServletRequestDispatcher.java:160)
                             at com.evermind.server.http.ServletRequestDispatcher.access$000(ServletRequestDispatcher.java:50)
                             at com.evermind.server.http.ServletRequestDispatcher$1.oc4jRun(ServletRequestDispatcher.java:97)
                             at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
                             at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:102)
                             at com.sage.servlet.ServletAdaptor.includeJSP(ServletAdaptor.java:122)
                             at com.sage.servlet.ServletAdaptor.includeDefaultJSP(ServletAdaptor.java:94)
                             at com.sage.servlet.ServletAdaptor.service(ServletAdaptor.java:66)
                             at inetmrp.servlet.ServletAdaptor.service(ServletAdaptor.java:119)
                             at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
                             at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
                             at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
                             at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
                             at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
                             at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
                             at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
                             at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
                             at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
                             at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
                             at java.lang.Thread.run(Thread.java:595)

                        com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpIOException: An existing connection was forcibly closed by the remote host
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindServletOutputStream.write(EvermindServletOutputStream.java:210)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindJSPWriter.writeOut(EvermindJSPWriter.java:539)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindJSPWriter.jspflush(EvermindJSPWriter.java:436)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindJSPWriter.close(EvermindJSPWriter.java:406)
                             at oracle.jsp.runtime.OracleJspRuntime.extraHandlePCFinally(OracleJspRuntime.java:1689)
                             at myinetmrp.my._jspService(_my.java:85)
                             at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.1.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
                             at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:701)
                             at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:405)
                             at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591)
                             at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515)
                             at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.unprivileged_include(ServletRequestDispatcher.java:160)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.access$000(ServletRequestDispatcher.java:50)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher$1.oc4jRun(ServletRequestDispatcher.java:97)
                             at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:102)
                             at com.sage.servlet.ServletAdaptor.includeJSP(ServletAdaptor.java:122)
                             at com.sage.servlet.ServletAdaptor.includeDefaultJSP(ServletAdaptor.java:94)
                             at com.sage.servlet.ServletAdaptor.service(ServletAdaptor.java:66)
                             at inetmrp.servlet.ServletAdaptor.service(ServletAdaptor.java:119)
                             at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
                             at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
                             at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
                             at java.lang.Thread.run(Thread.java:595)
                        07/03/05 09:52:37.78 intemrp: An existing connection was forcibly closed by the remote host
                        • 9. Re: An existing connection was forcibly closed by the remote host
                          239338
                          Frances,

                          A finally block cleared up the 'connection was forcibly closed' error.
                          However, in that block I say "try {} catch (exception, e) ....".
                          What would I put in the try? I don't have any connection a that point. This is a login module which uses DBProcDataSourceLoginModule and there fore is managed by JAZN.

                          TIA for any more help.
                          Ed.
                          • 10. Re: An existing connection was forcibly closed by the remote host
                            419601
                            After looking at the details, sorry that I don't think that ...
                            server.http.HttpIOException: An existing connection was forcibly closed by the remote host
                            has anything to do with data sources. You get the exception when
                            req.isRequestedSessionIdValid() is called.
                            I am not sure what's wrong. My guess is that the logout is not closing the sessions properly.
                            Maybe others could comment on ...
                            -Frances
                            • 11. Re: An existing connection was forcibly closed by the remote host
                              239338
                              Frances,

                              The line of code for:
                              at myinetmrp.my._jspService(_my.java:85)

                              is
                              JspFactory.getDefaultFactory().releasePageContext(pageContext);

                              I believe this what is causing the forcibly closed connection.....

                              But, what does it mean?
                              Am I missing a library?

                              If the logout procedure is not resetting the session properly, why would this also happen after a complete reboot? And if it can happen right after a reboot, what would I be looking for to prove it?

                              Ed.
                              • 12. Re: An existing connection was forcibly closed by the remote host
                                239338
                                Frances,

                                I need to update my previous post.

                                the "finally" block eliminated the cosole messages related to the "An existing connection was forcibly closed by the remote host" message but it did not eliminate the message in the application.log.

                                So, I'm still confused why this happens.

                                Ed.
                                • 13. Re: An existing connection was forcibly closed by the remote host
                                  419601
                                  As i said before, that I don't think that 'server.http.HttpIOException: An existing connection was forcibly closed by the remote host' has anything to do with data sources. So what i have suggested doesn't apply to your case.
                                  You get the exception when req.isRequestedSessionIdValid() is called.
                                  I am not sure what's wrong. Sorry.
                                  -Frances