Discussion:
[JIRA] Created: (MYO-90) Potential bug when direct connections become invalid
Gilles Rayrat (JIRA)
2009-05-12 22:36:09 UTC
Permalink
Potential bug when direct connections become invalid
----------------------------------------------------

Key: MYO-90
URL: https://forge.continuent.org/jira/browse/MYO-90
Project: Myosotis
Type: Bug

Reporter: Gilles Rayrat
Assigned to: Gilles Rayrat
Fix For: 0.6.6


If, for any reason, a direct connection becomes invalid, the getConnectionForRequest() can return this invalid connection
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
Gilles Rayrat (JIRA)
2009-05-12 22:38:09 UTC
Permalink
[ https://forge.continuent.org/jira/browse/MYO-90?page=comments#action_15511 ]

Gilles Rayrat commented on MYO-90:
----------------------------------

Applies to both protocols. Problem is:

private Connection getConnectionForRequest(String request) throws IOException {
if (!checkConnection())
return null;
Connection connectionToUse = connection;
if (connectionToUse == null)
return null;
if (directConnections.size() > 0) {
try {
if (connection.getAutoCommit() == true) {
String cleanQuery = request.trim().toLowerCase();
if (cleanQuery.startsWith("select ") && !cleanQuery.contains("for update")) {
// use direct connection
directConnectionsIndex++;
if (directConnectionsIndex >= directConnections.size())
directConnectionsIndex = 0;
connectionToUse = directConnections.get(directConnectionsIndex);
if (logger.isDebugEnabled())
logger.debug("Using direct connection " + connectionToUse.toString() + " for select query "
+ request);
if (connectionToUse == null || connectionToUse.isClosed()) {
=> if the connection is invalid, isClosed() will throw an exception...
connectionToUse = serverThread.getBackendConnection(directConnURLs
.elementAt(directConnectionsIndex));
directConnections.setElementAt(connectionToUse, directConnectionsIndex);
logger.debug("Connection #" + directConnectionsIndex + " renewed");
}
}
}
} catch (SQLException ignored) {
=> ... that we will just ignore. And connectionToUse is already set so we will return this invalid connection
}
}
return connectionToUse;
}
Post by Gilles Rayrat (JIRA)
Potential bug when direct connections become invalid
----------------------------------------------------
Key: MYO-90
URL: https://forge.continuent.org/jira/browse/MYO-90
Project: Myosotis
Type: Bug
Reporter: Gilles Rayrat
Assignee: Gilles Rayrat
Fix For: 0.6.6
If, for any reason, a direct connection becomes invalid, the getConnectionForRequest() can return this invalid connection
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
Gilles Rayrat (JIRA)
2009-08-20 09:58:47 UTC
Permalink
[ https://forge.continuent.org/jira/browse/MYO-90?page=all ]

Gilles Rayrat closed MYO-90:
----------------------------

Resolution: Fixed

Fixed in SVN: ProtocolHandler#getConnectionForRequest(request) now uses isValid(connection) (applies to both protocols)
Post by Gilles Rayrat (JIRA)
Potential bug when direct connections become invalid
----------------------------------------------------
Key: MYO-90
URL: https://forge.continuent.org/jira/browse/MYO-90
Project: Tungsten Connector
Type: Bug
Reporter: Gilles Rayrat
Assignee: Gilles Rayrat
Fix For: 0.6.8
If, for any reason, a direct connection becomes invalid, the getConnectionForRequest() can return this invalid connection
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
Loading...