You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/11/13 16:57:38 UTC

svn commit: r835892 - /incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java

Author: jbellis
Date: Fri Nov 13 15:57:38 2009
New Revision: 835892

URL: http://svn.apache.org/viewvc?rev=835892&view=rev
Log:
workaround for "Resource temporarily unavailable"
patch by jbellis; reviewed by Jaakko Laine for CASSANDRA-541

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java?rev=835892&r1=835891&r2=835892&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java Fri Nov 13 15:57:38 2009
@@ -219,8 +219,22 @@
                     }
                 }
                 
-                /* returns the number of bytes transferred from file to the socket */
-                long bytesTransferred = fc.transferTo(startPosition, limit, socketChannel_);
+                long bytesTransferred;
+                try
+                {
+                    /* returns the number of bytes transferred from file to the socket */
+                    bytesTransferred = fc.transferTo(startPosition, limit, socketChannel_);
+                }
+                catch (IOException e)
+                {
+                    // at least jdk1.6.0 on Linux seems to throw IOException
+                    // when the socket is full. (Bug fixed for 1.7: http://bugs.sun.com/view_bug.do?bug_id=5103988)
+                    // For now look for a specific string in for the message for the exception.
+                    if (!e.getMessage().startsWith("Resource temporarily unavailable"))
+                        throw e;
+                    Thread.sleep(10);
+                    continue;
+                }
                 if (logger_.isDebugEnabled())
                     logger_.debug("Bytes transferred " + bytesTransferred);                
                 bytesWritten += bytesTransferred;