Mantis - Quercus
Viewing Issue Advanced Details
2184 minor always 11-17-07 02:53 12-17-07 09:43
koreth  
ferg  
normal  
closed 3.1.4  
fixed  
none    
none 3.1.5  
0002184: IllegalStateException from query on closed connection
I've tried, but haven't been able to isolate this into a reproducible test case, so I'm going to just report it in the hopes it rings a bell. It's one of those "I see it in the real code base but only intermittently" things. Sometimes when I perform a query on a connection and the MySQL server has closed it down, something throws an IllegalStateException which gets propagated up the tree and messes up the application.

Here's my patch to JdbcConnectionResource.realQuery() that exposes the exception as a "connection lost" result that the PHP code can recover from, though I would find it more satisfying to know what the actual underlying problem is.

--- a/modules/quercus/src/com/caucho/quercus/lib/db/JdbcConnectionResource.java
+++ b/modules/quercus/src/com/caucho/quercus/lib/db/JdbcConnectionResource.java
@@ -649,6 +649,10 @@ public abstract class JdbcConnectionResource implements Clo
         log.log(Level.WARNING, e.toString(), e);
         return null;
       }
+ } catch (IllegalStateException e) {
+ // call on closed connection
+ saveErrors(new SQLException("Lost connection"));
+ return null;
     }
 
     return _rs;

There are no notes attached to this issue.