Marcus,
I am about to commit a patch to CVS. Would you please check it?
And it appears to me that there is a bug in your code.
> The attached patch goes a little further than just fixing the bug.
> I don't think it is wise to kill a connection after a minute
> execution time. Judge for yourself.
Well, as I read it, your code doesn't do what you think it does. You wrote:
if((entry.getStatus() == PoolConnEntry.ACTIVE) &&
(age > ACTIVE_CONN_TIME_LIMIT)) {
StringBuffer logBuffer =
new StringBuffer(128)
.append(" ***** connection ")
.append(entry.getId())
.append(" is way too old: ")
.append(age)
.append(" > ")
.append(ACTIVE_CONN_TIME_LIMIT);
getLogger().info(logBuffer.toString());
// This connection is way too old...
// but don't kill a running connection:
// finalizeEntry(entry);
continue;
}
if((entry.getStatus() == PoolConnEntry.ACTIVE) &&
(age > ACTIVE_CONN_TIME_LIMIT)) {
StringBuffer logBuffer =
new StringBuffer(128)
.append(" ***** connection ")
.append(entry.getId())
.append(" is long way too old: ")
.append(age)
.append(" > ")
.append(ACTIVE_CONN_HARD_TIME_LIMIT);
getLogger().info(logBuffer.toString());
// This connection is way too old...
// have to kill a running connection:
finalizeEntry(entry);
continue;
}
Apparently, you want to log when a connection is older than
ACTIVE_CONN_TIME_LIMIT and kill it when it is older than
ACTIVE_CONN_HARD_TIME_LIMIT. But the second if statement is (a) never hit
because of the continue, and (b) is identical to the first. So as I read
it, the code never releases a stuck and ACTIVE connection. There are
several possible fixes. I applied one, and set the hard limit to 5* the
point at which we start warning. Do you have any reason to believe that
there are legitimate reasons for a JDBC connection to be active for several
minutes, much less an hour?
FWIW, the reaper runs every 5 seconds, which means 12 log entries per minute
for stuck connections.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]