Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 49 by [email protected]: TCPTransportClient race condition when closing connecton
http://code.google.com/p/jdiameter/issues/detail?id=49

2) We found a possible race condition in TCPTransportClient.java: stop() - where a connection may be in the process of being connected (pending) when we try to close it, this results in the connection never being closed. Suggested fix is to add code to wait a maximum of 2 seconds for a pending connection before closing a connection: TCPTransportClient.java: stop()

         stop = true;
+ logger.debug("Waiting for any pending connections to connect (wait for a maximum of 2 second");
+    int count = 20;
+    socketChannel.finishConnect();
+ while (socketChannel != null && socketChannel.isConnectionPending() && count > 0) {
+        try{
+        socketChannel.finishConnect();
+        Thread.sleep(100);
+        }
+        catch(IOException e){
+        logger.error("IO Error", e);
+        }
+        catch (InterruptedException ex) {
+        logger.error("InterruptedException Error", ex);
+        }
+        count--;
+    }
+
         if (socketChannel != null && socketChannel.isOpen()) {



--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- You received this message because you are subscribed to the Google Groups "mobicents-all-issues-changes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to