Bug 507370 - ssltunnel may hang with 100% CPU load, breaking the tests execution, r=ted.mielczarek, a=beltzner
authorHonza Bambas <honzab.moz@firemni.cz>
Thu, 06 Aug 2009 16:29:26 +0200
changeset 31175 b61bc50678e77d7b03e8aa26ed1305b0af3d933c
parent 31174 91db32e73fc0091998efc1852d60a94d1450fd43
child 31176 97f2cc123118503f5a7ecd67fea7f41c4bf51b65
push id8408
push userhonzab.moz@firemni.cz
push dateThu, 06 Aug 2009 14:30:06 +0000
treeherdermozilla-central@97f2cc123118 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted.mielczarek, beltzner
bugs507370
milestone1.9.2a1pre
Bug 507370 - ssltunnel may hang with 100% CPU load, breaking the tests execution, r=ted.mielczarek, a=beltzner
testing/mochitest/ssltunnel/ssltunnel.cpp
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
@@ -474,18 +474,22 @@ void HandleConnection(void* data)
 
         if (out_flags & PR_POLL_WRITE)
         {
           PRInt32 bytesWrite = PR_Send(sockets[s].fd, buffers[s2].bufferhead, 
               buffers[s2].present(), 0, PR_INTERVAL_NO_TIMEOUT);
 
           if (bytesWrite < 0)
           {
-            if (PR_GetError() != PR_WOULD_BLOCK_ERROR)
+            if (PR_GetError() != PR_WOULD_BLOCK_ERROR) {
               client_error = true;
+              // We got a fatal error while writting the buffer. Clear it to break
+              // the main loop, we will never more be able to send it.
+              buffers[s2].bufferhead = buffers[s2].buffertail = buffers[s2].buffer;
+            }
           }
           else
           {
             buffers[s2].bufferhead += bytesWrite;
             if (buffers[s2].present())
               in_flags |= PR_POLL_WRITE;              
             else
             {