java weblogic服务器中的连接泄漏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14747922/
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-10-31 17:15:45  来源:igfitidea点击:

Leaked connection in weblogic server

javajakarta-eeweblogicconnection-pooling

提问by Abhij

enter image description here

在此处输入图片说明

Hi All need to know what this leaked connection count stands for?
I have closed all statement and connection object in finally block in my code.
Is this are connections that are idle longer than max idle timeout or this is count of connections recovered by Weblogic server which are leaked.

大家好,需要知道这个泄漏的连接数代表什么吗?
我已经关闭了代码中 finally 块中的所有语句和连接对象。
这是空闲时间长于最大空闲超时的连接还是 Weblogic 服务器恢复的泄漏连接计数

回答by Viccari

From WebLogic help page on the administration console:

从管理控制台上的 WebLogic 帮助页面:

Leaked Connection Count

The number of leaked connections. A leaked connection is a connection that was reserved from the data source but was not returned to the data source by calling close().

泄漏的连接数

泄漏的连接数。泄漏连接是从数据源保留但未通过调用 close() 返回到数据源的连接。

There are some things that might be causing these leaks. One worth mentioning that might help you (happened to me in the past) is: check the status of the threads on your server (Environment/Servers/[Your Server]/Monitoring/Threads). Sometimes, a stuck thread (waiting for I/O or whatever) might cause a connection to reach WebLogic timeout before your code hits close() and so mark the connection as leaked. Anyway, if this is the case, it is generally a code issue. The time between you open a connection and close it should be minimal. The code you run between these calls should also be as minimal as possible.

有一些事情可能会导致这些泄漏。值得一提的可能对您有帮助(过去发生在我身上)是:检查服务器上线程的状态 ( Environment/Servers/[Your Server]/Monitoring/Threads)。有时,卡住的线程(等待 I/O 或其他)可能会导致连接在您的代码命中 close() 之前达到 WebLogic 超时,因此将连接标记为泄漏。无论如何,如果是这种情况,通常是代码问题。打开连接和关闭连接之间的时间应该最短。您在这些调用之间运行的代码也应尽可能少。

回答by rakehell

Usually, your connection acquisition/use code is in a try-catch block. The most commonly used solution for this problem is to add a "finally" clause and close the connection.

通常,您的连接获取/使用代码位于 try-catch 块中。这个问题最常用的解决方案是添加一个“finally”子句并关闭连接。

回答by Suresh Ram

Leaked Connection means WebLogic is able to recover a unused connection after the idle time out is exceeded. Usually this happens when the front end users session is not closed properly.

泄漏连接意味着 WebLogic 能够在超过空闲超时后恢复未使用的连接。通常,当前端用户会话未正确关闭时会发生这种情况。

Further read available here

在此处进一步阅读