MySQL/Hibernate - How do I debug a MySQL pooled connection that keeps dropping?

后端 未结 3 1675
离开以前
离开以前 2021-02-14 02:51

For months, my web application ran smoothly, but for the past week or two, it keeps dropping its connection to MySQL server. I\'m not a DBA guy and have no idea how to debug thi

3条回答
  •  忘掉有多难
    2021-02-14 03:18

    Hibernate errors are a bit abstract and sometimes it can be tricky to find the bug by the stack trace. I think that may be a problem of your application, maybe you're not closing Hibernate connections properly on some cases or your application may have a memory leak.

    Have you tried to monitor the application with jconsole from the JDK?

    You can set this on your Tomcat configuration console in the Java arguments (I'm assuming you're using Tomcat), to enable the jconsole

    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.port=8086
    -Dcom.sun.management.jmxremote.ssl=false
    -Dcom.sun.management.jmxremote.authenticate=false
    

    Then connect to a remote process for example

    localhost:8086 
    

    and watch the threads as you go thru the operations that make the application stop.

    Edit

    If you're not using Tomcat and you're running your application in a Windows environment you can monitorize the threads using for example Process Explorer and monitorize your application.

提交回复
热议问题