browser freeze - JSP

User f52820d97e

21-02-2007 15:50:13

Hi,


I implemented the JSP examples from the JChem distribution, but for some time now I get a very annoying error - my browser freezes after a few queries. I could reproduce it with Firefox and Internet explorer, either on windows or linux.


It seems to happen when I do a series of queries with unlimited hits and time


Looking at the catalina.out, I see a


Code:
21 févr. 2007 16:44:13 org.apache.catalina.session.StandardManager start


GRAVE: Exception au chargement des sessions depuis le stockage persistant (persistent storage)


java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.mysql.jdbc.DatabaseMetaData


[...]


Caused by: java.io.NotSerializableException: com.mysql.jdbc.DatabaseMetaData





It did not seem to happen with the previous versions, but I can be mistaken


I have
    JChem_3.2.3


    java_1.5.0_11


    apache-tomcat-5.5.12


    mysql-connector-java-5.0.4
Could you help me out?


Nicolas

ChemAxon 9c0afc9aaf

21-02-2007 16:07:22

Hi Nicolas,





The error text on the server side is harmless and has nothing to do with the client side problem.





When you shut down and restart Tomcat, it automatically tries to preserve the state of the sessions via serialization (converting Java objects into binary form). If it encounters non-serializable objects amongst session variables it will throw an exception, and will not initialize this variable, but this does not do any harm.





This is a relatively new feature in Tomcat.





I suggest you to turn it off to prevent these messages flood your log file.


This may very bit according to Tomcat version.


If using the latest version (5.5) please do the following:





Locate





Code:
<tomcat_home_dir>/conf/context.xml






Uncomment this line:





Code:
<Manager pathname="" />






Of course this will not solve the freezing issue, just make the server side log cleaner.





My colleagues will investigate the browser problem soon.





Best regards,





Szilard

User f52820d97e

21-02-2007 16:31:40

Hi Szilard!


Thanks for the tip, but actually the line is already uncommented... so it tries to serialize by default?


I should also give you my configuration: everything I changed is in the webapps folder cermn (my lab) and not in the tomcat/conf folder


here is the META-INF/context.xml file:


Code:
<Context path="/cermn" docBase="cermn" debug="5" reloadable="true" crossContext="true">





<Resource name="jdbc/cermn"


        auth="Container"


        type="javax.sql.DataSource"


        maxActive="100"


        maxIdle="30"


        maxWait="10000"


        removeAbandoned="true"


        removeAbandonedTimeout="200"


        logAbandoned="true"


        username="root"


        password="XXX"


        driverClassName="com.mysql.jdbc.Driver"


        url="jdbc:mysql://localhost:3306/CERMN?autoReconnect=true"/>





<Realm


        className="org.apache.catalina.realm.DataSourceRealm"


        debug="99"


        dataSourceName="jdbc/cermn"


        userTable="users"


        userNameCol="user_name"


        userCredCol="user_pass"


        userRoleTable="user_roles"


        roleNameCol="role_name"


        digest="MD5"


        localDataSource="true"/>





</Context>





And the WEB-INF/web.xml one (I have two sets of slightly modified JSPs, one for the user, one for the admin - with restrictions in different .jchemsite files)


Code:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">





  <description>CERMN Chemolibrary - N.Saettel</description>





  <resource-ref>


      <description>DB Connection JChem</description>


      <res-ref-name>jdbc/cermn</res-ref-name>


      <res-type>javax.sql.DataSource</res-type>


      <res-auth>Container</res-auth>


  </resource-ref>





    <security-constraint>


    <web-resource-collection>


      <web-resource-name>cermn-administration</web-resource-name>


      <url-pattern>/admin/*</url-pattern>


    </web-resource-collection>


    <auth-constraint>


      <role-name>admin</role-name>


    </auth-constraint>


    </security-constraint>





    <security-constraint>


    <web-resource-collection>


      <web-resource-name>cermn-use</web-resource-name>


      <url-pattern>/user/*</url-pattern>


    </web-resource-collection>


    <auth-constraint>


      <role-name>user</role-name>


      <role-name>admin</role-name>


    </auth-constraint>


    </security-constraint>





    <login-config>


      <auth-method>FORM</auth-method>


      <form-login-config>


      <form-login-page>/login.jsp</form-login-page>


      <form-error-page>/notAuthenticated.jsp</form-error-page>


      </form-login-config>


    </login-config>





    <session-config>


     <session-timeout>30</session-timeout>


    </session-config>





</web-app>

ChemAxon 9c0afc9aaf

21-02-2007 18:24:08

Hi,
Quote:
Thanks for the tip, but actually the line is already uncommented... so it tries to serialize by default?


I should also give you my configuration: everything I changed is in the webapps folder cermn (my lab) and not in the tomcat/conf folder
Maybe I wasn't quite clear on this


By default the line is commented out. I'm asking you to activate (uncomment) this line. If the line is present and the path is empty, it should not try to serialize.





Please consult the Tomcat manual if this fails (maybe you have an other version).





Anyway, it should not be a disaster if you cannot solve this, as


- it will not fix the browser freeze problem, as server-side problems usually cannot cause client-side problems like that


- it's a not a real problem even on the server side


- the error text only occurs when you restart Tomcat - so it should not excessively flood your log





Best regards,





Szilard

User f52820d97e

21-02-2007 18:46:44

Ooops... I mixed up uncomment/comment out/whatever, it is fixed now! It did the trick!


I did a dozen of queries, different parameters, everything is A-OK.


I just saw this below in catalina.out but I did not see anything going wrong on the client side...


Thanks A LOT!


Nicolas





Code:
21 févr. 2007 19:36:45 org.apache.catalina.core.StandardWrapperValve invoke


GRAVE: "Servlet.service()" pour la servlet jsp a généré une exception


java.lang.IllegalStateException: "getOutputStream()" a déjà été appelé pour cette réponse


        at org.apache.catalina.connector.Response.getWriter(Response.java:606)


        at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:195)


        at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)


        at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)


        at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:191)


        at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)


        at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)


        at org.apache.jsp.user.jsp.transfer.export_jsp._jspService(org.apache.jsp.user.jsp.transfer.export_jsp:280)


        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)


        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)


        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)


        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)


        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)


        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)


        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)


        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)


        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:514)


        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)


        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)


        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)


        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)


        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)


        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)


        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:744)


        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:674)


        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:866)


        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)


        at java.lang.Thread.run(Thread.java:595)


User f52820d97e

23-02-2007 13:51:02

Hi Szilard,


I may have jumped of joy too quickly; I got several freezes today...


and this error again (in French, soory!


Code:
23 févr. 2007 14:43:27 org.apache.catalina.core.StandardWrapperValve invoke


GRAVE: "Servlet.service()" pour la servlet jsp a généré une exception


java.lang.IllegalStateException: "getOutputStream()" a déjà été appelé pour cette réponse



Any ideas on what happens?


Nicolas

User f52820d97e

23-02-2007 14:22:27

the latter error happened when I tried to export a result query, now I got another freeze and NOTHING in the catalina.out...


I am lost there...

ChemAxon 9c0afc9aaf

23-02-2007 14:47:52

Hi Nicolas,





As I have pointed out before, server side problems are not responsible for the client side freezes, these are completely different issues.





We will investigate both the server and client side problems, and bet back to you soon.





By the way : is your export successful or fails when you see the server-side error ?





Best regards,





Szilard

User f52820d97e

23-02-2007 14:56:56

You are right, it has nothing to do with the client - I just thought it was related since it froze just after...


And I could export fine!

ChemAxon 7c2d26e5cf

23-02-2007 16:03:54

Hi Nicolas,


We try to debug the browser freezing issue. It is not easy because it is not always reproducable and it does not occure on any machine.


Can you describe, your machine's hardware configuration? We have managed to reproduce this error only on a dual core machine. Can you give also the type of your operating system and the version of firefox where this freezing is occured?

User f52820d97e

07-03-2007 09:18:07

Sorry for the delay Szilard,


Here are the 2 stations I work on and have problems with:andMy server is on the latter machine:Hope it can help... I keep getting the freezes...


Cheers,


Nicolas

User f52820d97e

07-03-2007 10:06:38

I just tried with another workstation, Windows XP SP2, Intel Pentium 4 3.06GHz, 2 Gb RAM, java 1.5.0_6-b05, either with internet explorer or firefox.


The freeze happens after a number of queries (I used unlimited time and hits, but I am not sure that is the problem)


It seems that the java runtime environment is not responding, I cannot pop up the console anymore...

ChemAxon 7c2d26e5cf

07-03-2007 10:12:59

Thanks for the info.


We have debugged the issue. It was a dead lock in MarvinSketch applet's initalization. We have fixed it.


Now, we are testing the applet. The new release (with the bugfix) will be available soon.

ChemAxon 7c2d26e5cf

07-03-2007 10:19:27

By the way, this trick (that is mentioned in the linked Java forum topic) helped me to retrieve the thread dump from JVM by browser freezing. This helped me a lot to find the deadlock.


http://forum.java.sun.com/thread.jspa?threadID=760578&messageID=4342119

User f52820d97e

07-03-2007 10:19:27

Great!!! I am relieved... I thought I corrupted something in the scripts...


Cheers,


Nicolas

User f52820d97e

07-03-2007 10:33:33

thanks for the trick too, it can come in handy...