6 Replies Latest reply on Sep 25, 2002 1:09 PM by jules

    HttpSession clustering - failover problems

    marcin

      Hi!

      Finally i got working clustering: discovering, farming and httpsession clustering.

      But not everything works appropriate. I wrote very simple servlet which writes to session some attributes. And when i test it on the 2 nodes:

      - on the server1 i add attributes to session, when i look at logs the sessions seems to replicate
      - when i down the server1 my loadbalancer redirects the request to server2 and what happens: while HttpSession.setAttribute(...) is called the exception is raised.

      What to do?

      My configuration is:
      server1 - linux redhat 7.2, java sun 1.3.1, JBoss 3.0.2
      server2 - linux redhat 7.2, java sun 1.3.1, JBoss 3.0.2

      I have deployed jbossha-httpsession.sar.

      Marcin

      Below is a stack trace which is logged.

      13:05:45,338 ERROR [MarshallingInterceptor] could not get Attribute: azzz
      java.io.StreamCorruptedException: InputStream does not contain a serialized object
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
      at java.io.ObjectInputStream.(ObjectInputStream.java:168)
      at org.mortbay.j2ee.session.MarshallingInterceptor$ObjectInputStream.(MarshallingInterceptor.java:43)
      at org.mortbay.j2ee.session.MarshallingInterceptor.demarshal(MarshallingInterceptor.java:83)
      at org.mortbay.j2ee.session.MarshallingInterceptor.getAttribute(MarshallingInterceptor.java:93)
      at org.mortbay.j2ee.session.StateInterceptor.getAttribute(StateInterceptor.java:43)
      at org.mortbay.j2ee.session.StateInterceptor.getAttribute(StateInterceptor.java:43)
      at org.mortbay.j2ee.session.TypeCheckingInterceptor.getAttribute(TypeCheckingInterceptor.java:90)
      at org.mortbay.j2ee.session.StateAdaptor.getAttribute(StateAdaptor.java:204)
      at servlet_test.SessionTest.doGet(SessionTest.java:36)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:344)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:313)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:554)
      at org.mortbay.jetty.servlet.WebApplicationHandler.handle(WebApplicationHandler.java:199)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1572)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1522)
      at org.mortbay.http.HttpServer.service(HttpServer.java:795)
      at org.jboss.jetty.Jetty.service(Jetty.java:531)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:784)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:941)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:799)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:186)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:322)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:716)
      at java.lang.Thread.run(Thread.java:484)
      13:05:45,360 WARN [jbossweb] WARNING: Exception for /test/sessiontest?name=123213&value=12321321&go=Prze%B6lij+kwerend%EA
      java.lang.IllegalArgumentException: could not get Attribute
      at org.mortbay.j2ee.session.MarshallingInterceptor.getAttribute(MarshallingInterceptor.java:102)
      at org.mortbay.j2ee.session.StateInterceptor.getAttribute(StateInterceptor.java:43)
      at org.mortbay.j2ee.session.StateInterceptor.getAttribute(StateInterceptor.java:43)
      at org.mortbay.j2ee.session.TypeCheckingInterceptor.getAttribute(TypeCheckingInterceptor.java:90)
      at org.mortbay.j2ee.session.StateAdaptor.getAttribute(StateAdaptor.java:204)
      at servlet_test.SessionTest.doGet(SessionTest.java:36)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:344)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:313)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:554)
      at org.mortbay.jetty.servlet.WebApplicationHandler.handle(WebApplicationHandler.java:199)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1572)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1522)
      at org.mortbay.http.HttpServer.service(HttpServer.java:795)
      at org.jboss.jetty.Jetty.service(Jetty.java:531)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:784)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:941)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:799)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:186)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:322)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:716)
      at java.lang.Thread.run(Thread.java:484)

        • 1. Re: HttpSession clustering - failover problems
          jakefear

          Sounds to me like you are not putting serializable objects in the session. I would expect that to be a limitation of any session replication (WLS has this as well), all objects in session must be serializable.

          Cheers,
          jake

          • 2. Re: HttpSession clustering - failover problems

            Jetty session distribution has moved on.

            Take the jbossweb.sar from the 3.2beta and try that. You may also need the jbossweb-ejb.jar.

            Let me know if you have any trouble.

            You can configure (in jbossweb.sar/META-INF/jboss-service.xml) whether you want CMP or JavaGroups based distribution.

            I would go with the CMP-based, as this is slow but very robust. The JavaGroups one exposes a deadlocking bug which Bela has just fixed. If you really want to use it under stress you should d/l the latest version of JavaGroups and use that in your JBoss dist...

            I am doing a lot of work in this area at the moment and would be interested in your feedback. Please keep me informed.

            Thanks,


            Jules@mortbay.com


            • 3. Re: HttpSession clustering - failover problems
              marcin

              jakefar,

              i am sure that this is not the case. I deployed very very simple example just to check if it works.

              Anyway thanks for the reply, I thought that no one reads these posts... :-(

              Regards,
              Marcin

              • 4. Re: HttpSession clustering - failover problems
                marcin

                jules,

                as soon as i'll have some time i do what you said and i'll inform you about the results.

                Thank you,

                Marcin

                • 5. Re: HttpSession clustering - failover problems
                  mszybist

                  hi!

                  read it often :)

                  But there seems to be more questions than answers :)

                  Michel

                  • 6. Re: HttpSession clustering - failover problems

                    Marcin,

                    I fogot to mention - if you go with the CMP solution, you need to make sure that the EJB tiers are pointnig at the same DB - otherwise the data will not be distributed.

                    If you are using HyperSonic just go into your deploy dir and swap the localhost in the url to all point to the same host.

                    Any problems, drop me a line.

                    Jules