Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.0.3, 2.1.1, 1.6.4
-
None
Description
Starting with 1.6.X, when a statement is closed, it has a result set and streaming is enabled, a kill command is sent out. That killed our application since we have a large scale application with hundreds of processes. cancelCurrentQuery creates a new connection and sends a kill command. If a new connection is created for every select, there are thousands of sockets left in TIMED_WAIT and the server cannot create new connections.
This should be done in a dedicated, pooled connection. In addition to that, the code should check if the result set was already consumed and skip kill since there will be nothing to do anyway. In this case, even if a new connection is done, it will be done in 0.01% of the cases where the app abourts the ResultSet.
public void close() throws SQLException { |
lock.lock();
|
try { |
closed = true; |
|
if (results.getFetchSize() != 0) { |
if (options.killFetchStmtOnClose) { |
try { |
protocol.cancelCurrentQuery();
|
skipMoreResults();
|
} catch (SQLException sqle) { |
//eat exception |
} catch (IOException sqle) { |
//eat exception |
}
|
} else skipMoreResults(); |
}
|
|
results.close();
|
protocol = null; |
|
if (connection == null || connection.pooledConnection == null |
|| connection.pooledConnection.statementEventListeners.isEmpty()) {
|
return; |
}
|
connection.pooledConnection.fireStatementClosed(this); |
} finally { |
lock.unlock();
|
}
|
}
|
Attachments
Issue Links
- is caused by
-
CONJ-315 Cannot cancel Streaming result sets
- Closed