db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1158108 - /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
Date Tue, 16 Aug 2011 05:46:48 GMT
Author: kristwaa
Date: Tue Aug 16 05:46:48 2011
New Revision: 1158108

URL: http://svn.apache.org/viewvc?rev=1158108&view=rev
Log:
DERBY-5271: Client may hang if the server crashes due to a java.lang.Error

Tries to ensure that if the network server crashes due to a condition
raising java.lang.Error, the client socket will be closed on the server
side. Note that even if one of the worker threads crashes, the network
server itself may remain operational. If the JVM process dies, the
sockets will be closed anyway.

Patch file: derby-5271-1a-inital_fix_proposal.diff

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=1158108&r1=1158107&r2=1158108&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Tue Aug 16
05:46:48 2011
@@ -318,7 +318,22 @@ class DRDAConnThread extends Thread {
 				{
 					handleException(e);
 				}
-			}
+            } catch (Error error) {
+                // Do as little as possible, but try to cut loose the client
+                // to avoid that it hangs in a socket read-call.
+                try {
+                    closeSession();
+                } catch (Throwable t) {
+                    // One last attempt...
+                    try {
+                        session.clientSocket.close();
+                    } catch (IOException ioe) {
+                        // Ignore, we're in deeper trouble already.
+                    } 
+                } finally {
+                    throw error;
+                }
+            }
 		}
 		if (SanityManager.DEBUG)
 			trace("Ending connection thread");



Mime
View raw message