2023年12月8日发(作者:)

overableException:IO错误:Socketc。。

今天weblogic的alllog日志报了很多socket closed的错误。

### Cause: nnectionException: IO 错误: Socket closed

at ception(:23) ~[:na]

at List(:104) ~[:na]

at List(:95) ~[:na]

at One(:59) ~[:na]

at sDAO$e(:241) ~[:1.3.1-20141225]

at eWork(:54) ~[:]

at nImpl$(:1936) ~[:]

at nImpl$(:1933) ~[:]

at nateWork(:211) ~[arty-

:]

at (:1954) ~[:]

at (:1940) ~[:]

at ect(:236) ~[:1.3.1-20141225]

... 75 common frames omitted

Caused by: nnectionException: IO 错误: Socket closed

at t(:131) ~[arty-

:]

at t(:49) ~

[:]

at t(:125) ~[arty-hibernate-core-

:]

at t(:110) ~[arty-hibernate-core-

:]

at ueInvocation(:129)

~[:]

at (:81) ~[arty-hibernate-

:]

at .$e(Unknown Source) ~[na:na]

at (:56) ~[gg-top-corm-3.1.2-

:na]

at (:70) ~[gg-top-corm-3.1.2-

:na]

at (Unknown Source) ~[na:na]

at (:43) ~[na:1.7.0_40]

at (:606) ~[na:1.7.0_40]

at (:59) ~[:na]

at .$(Unknown Source) ~[na:na]

at y(:69) ~[:na]

at romDatabase(:267) ~[:na]

at (:141) ~[:na]

at (:105) ~[:na]

at (:81) ~[:na]

at List(:101) ~[:na]

... 85 common frames omitted

Caused by: overableException: IO 错误: Socket closed

at eForDescribe(:897) ~[:11.2.0.3.0]

at eMaybeDescribe(:1167) ~[:11.2.0.3.0]

at uteWithTimeout(:1289) ~[:11.2.0.3.0]

at eInternal(:3594) ~[:11.2.0.3.0]

at e(:3695) ~[:11.2.0.3.0]

at e(:1378) ~[:11.2.0.3.0]

at e(:101) ~[:12.1.2.0.0]

at (Unknown Source) ~[na:na]

at (:43) ~[na:1.7.0_40]

at (:606) ~[na:1.7.0_40]

at ueInvocation(:122)

~[:]

... 100 common frames omitted

Caused by: Exception: Socket closed

at Read0(Native Method) ~[na:1.7.0_40]

at (:152) ~[na:1.7.0_40]

at (:122) ~[na:1.7.0_40]

at e(:300) ~[:11.2.0.3.0]

at e(:106) ~[:11.2.0.3.0]

at tPacket(:315) ~[:11.2.0.3.0]

at (:260) ~[:11.2.0.3.0]

at (:185) ~[:11.2.0.3.0]

at (:102) ~[:11.2.0.3.0]

at xtPacket(:124) ~[:11.2.0.3.0]

at (:80) ~[:11.2.0.3.0]

at halUB1(:1137) ~[:11.2.0.3.0]

at e(:290) ~[:11.2.0.3.0]

at (:192) ~[:11.2.0.3.0]

at (:531) ~[:11.2.0.3.0]

at 8(:207) ~[:11.2.0.3.0]

at eForDescribe(:884) ~[:11.2.0.3.0]

... 110 common frames omitted

再检查server日志,发现在alllog中报socket closed错误的时段:

####<2015-1-5 上午11时37分22秒 CST> <[ACTIVE] ExecuteThread: '3' for queue:

't (self-tuning)'> <> <> <> <142>

has been closed.>

####<2015-1-5 上午11时38分32秒 CST> <[ACTIVE] ExecuteThread: '3' for queue:

't (self-tuning)'> <> <> <> <142>

has been closed.>

####<2015-1-5 上午11时38分52秒 CST> <[ACTIVE] ExecuteThread: '1' for queue:

't (self-tuning)'> <> <> <> <142>

has been closed.>

####<2015-1-5 上午11时51分32秒 CST> <[ACTIVE] ExecuteThread: '13' for queue:

't (self-tuning)'> <> <> <> <142>

has been closed.>

连接池关闭,连接池为甚关闭呢?在此时间段只有一条SQL报错,为什么不是大规模的报错呢?

与一名开发人员反馈,说每次都可以出现,于是找他重现。在16点到17点重现了,但在17点到18点又重现不了,我无意识的看了两个时段

的AWR报告,发现有报错时段的SQL执行时37s,没有报错时段的SQL执行是2s。

我怀疑与非活动连接超时这个参数有关系,于是找了一个功能为120s的,做了个测试:

非活动连接超时

1

5

10

等待多少秒后报错

20s

16s

40s

15

30

50

不报错,等待120s后功能出来了

同上

同上

总结:治标的调大非活动连接超时这个参数,治本的方法是调优SQL。

A leaked connection is a connection that was not properly returned to the connection pool in the data source. To automatically recover leaked connections,

you can specify a value for

Inactive Connection Timeout

on the JDBC Data Source: Configuration: Connection Pool page in the Administration Console.

When you set a value for

Inactive Connection Timeout,

WebLogic Server forcibly returns a connection to the data source when there is no activity on a

reserved connection for the number of seconds that you specify. When set to

0

(the default value), this feature is turned off.