Subject | FBManagedConnection |
---|---|
Author | Stefan Mühlemann |
Post date | 2002-09-27T05:02:25Z |
Hello,
i had the problem, when i used built in pooling and had no active
connection, after idletimeout was gone the connection was not returned
properly to firebird.
FBWrappingDataSource returned connection and created a new one because
minSize of pooling was 1.
But the connection was not returned to firebird. So after a while it
ended up eating all my resources of firebird (many, many open
connections).
The code i think is the problem (from FBManagedConnection.destroy()):
if (currentDbHandle != null) {
try {
// if (log!=null) log.debug("in
ManagedConnection.destroy",new Exception());
mcf.releaseDbHandle(currentDbHandle, cri);
}
catch (GDSException ge) {
System.out.println(getClass().getName() + " / Can't
detach from db: " + ge.toString());
throw new ResourceException("Can't detach from db: " +
ge.toString());
}
finally {
currentDbHandle = null;
}
}
If currentDbHandle is null nothing happends to this open connection.
I changed it to:
if (currentDbHandle == null) {
try {
currentDbHandle = getIscDBHandle();
}
catch (XAException xae) {
System.out.println(getClass().getName() + " /
XAException " + xae.getMessage());
}
}
if (currentDbHandle != null) {
try {
// if (log!=null) log.debug("in
ManagedConnection.destroy",new Exception());
.....
What do you think.
Did i do something wrong before reaching this? I do not understand wher
this currentDbHandle is set, so maybe the problem is somewhere else....
Greetings
Stefan Mühlemann
i had the problem, when i used built in pooling and had no active
connection, after idletimeout was gone the connection was not returned
properly to firebird.
FBWrappingDataSource returned connection and created a new one because
minSize of pooling was 1.
But the connection was not returned to firebird. So after a while it
ended up eating all my resources of firebird (many, many open
connections).
The code i think is the problem (from FBManagedConnection.destroy()):
if (currentDbHandle != null) {
try {
// if (log!=null) log.debug("in
ManagedConnection.destroy",new Exception());
mcf.releaseDbHandle(currentDbHandle, cri);
}
catch (GDSException ge) {
System.out.println(getClass().getName() + " / Can't
detach from db: " + ge.toString());
throw new ResourceException("Can't detach from db: " +
ge.toString());
}
finally {
currentDbHandle = null;
}
}
If currentDbHandle is null nothing happends to this open connection.
I changed it to:
if (currentDbHandle == null) {
try {
currentDbHandle = getIscDBHandle();
}
catch (XAException xae) {
System.out.println(getClass().getName() + " /
XAException " + xae.getMessage());
}
}
if (currentDbHandle != null) {
try {
// if (log!=null) log.debug("in
ManagedConnection.destroy",new Exception());
.....
What do you think.
Did i do something wrong before reaching this? I do not understand wher
this currentDbHandle is set, so maybe the problem is somewhere else....
Greetings
Stefan Mühlemann