java.net.SocketException: 管道损坏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/682560/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 17:51:16  来源:igfitidea点击:

java.net.SocketException: Broken pipe

javasocketspiperesin

提问by Java Guy

I am getting this for all the database connections from my app server..
This exception occured for couple of hours, then got fixed by itself.
Something to do with network connection from the appserver?

我从我的应用程序服务器获取所有数据库连接的这个。
这个异常发生了几个小时,然后自行修复。
与来自应用程序服务器的网络连接有关吗?

java.net.SocketException: Broken pipe
com.inet.tds.SQLException: java.net.SocketException: Broken pipe
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 com.inet.tds.a.a(Unknown Source)
    at com.inet.tds.a.a(Unknown Source)
    at com.inet.tds.a.commit(Unknown Source)
    at com.inet.pool.a.commit(Unknown Source)

回答by Java Guy

It means you client has disconnected from the server; check if it is running. See here

这意味着您的客户端已与服务器断开连接;检查它是否正在运行。看这里

回答by ng.

During a write the connection was severed, this can be due the the destination closing the connection or the destination process has terminated. Its not an error with your implementation.

在写入期间连接被切断,这可能是由于目标关闭连接或目标进程已终止。这不是您的实现错误。

回答by yogman

For MySQL, "By default, the server closes the connection after eight hours if nothing has happened." And, MySQL has a reconnect feature that supports auto-reconnect after the closed connection is detected on the client side.

对于 MySQL,“默认情况下,如果没有发生任何事情,服务器会在八小时后关闭连接。” 并且,MySQL 具有重新连接功能,支持在客户端检测到关闭的连接后自动重新连接。

Eight hours? With the use of connection pooling or a long-running background job, that is possible.

八小时?通过使用连接池或长时间运行的后台作业,这是可能的。

http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

http://dev.mysql.com/doc/refman/5.0/en/gone-away.html