java. net. Socketexception: pipe breakage

I receive this error or my JSP page every day:

java.net.socketException

Message: pipe breakage

Stack trace:

java.net.socketException: Broken pipe
        at java.net.socketOutputStream.socketWrite0(Native Method)
        at java.net.socketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.socketOutputStream.write(SocketOutputStream.java:136)
        at java.io.bufferedoutputstream.flushBuffer(bufferedoutputstream.java:65)
        at java.io.bufferedoutputstream.flush(bufferedoutputstream.java:123)
        at com.MysqL.jdbc.MysqLIO.send(MysqLIO.java:2637)
        ....

After restarting Tomcat service, it works normally (I use hibernate to connect to the MySQL database)

Solution

I'd like to speculate, but if this happens every morning (i.e. after an inactive night), it may be related to the wait_timeout after MySQL closes 8 hours by default

If so:

>Configure Tomcat to test the borrowed connection using validationquery in the data source configuration:

<parameter>
  <name>validationQuery</name>
  <value>select 1</value>
</parameter>

>Pass my cnf / my. Ini increase the wait of MySQL_ Timeout, or connect to the command line SQL client and enter set global wait_ Timeout = 86400 or other appropriate number of seconds

I didn't know all the consequences of the second option, didn't really recommend it, at least didn't get more feedback from MySQL experts

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>