Matt Witherspoon fixed a problem case when the CPU load went to 100% when a
authorDaniel Stenberg <daniel@haxx.se>
Tue, 5 Dec 2006 13:37:05 +0000 (13:37 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 5 Dec 2006 13:37:05 +0000 (13:37 +0000)
HTTP upload was disconnected:

"What appears to be happening is that my system (Linux 2.6.17 and 2.6.13) is
setting *only* POLLHUP on poll() when the conditions in my previous mail
occur. As you can see, select.c:Curl_select() does not check for POLLHUP. So
basically what was happening, is poll() was returning immediately (with
POLLHUP set), but when Curl_select() looked at the bits, neither POLLERR or
POLLOUT was set. This still caused Curl_readwrite() to be called, which
quickly returned. Then the transfer() loop kept continuing at full speed
forever."

CHANGES
RELEASE-NOTES
lib/select.c

diff --git a/CHANGES b/CHANGES
index d98d43beba0b1df5cfd44d6a1c1821873fa60db1..0da422072f1ec7865bcbcf655b4217aaee1ce6b4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,19 @@
 
                                   Changelog
 
+Daniel (5 December 2006)
+- Matt Witherspoon fixed a problem case when the CPU load went to 100% when a
+  HTTP upload was disconnected:
+
+  "What appears to be happening is that my system (Linux 2.6.17 and 2.6.13) is
+  setting *only* POLLHUP on poll() when the conditions in my previous mail
+  occur. As you can see, select.c:Curl_select() does not check for POLLHUP. So
+  basically what was happening, is poll() was returning immediately (with
+  POLLHUP set), but when Curl_select() looked at the bits, neither POLLERR or
+  POLLOUT was set. This still caused Curl_readwrite() to be called, which
+  quickly returned. Then the transfer() loop kept continuing at full speed
+  forever."
+
 Daniel (1 December 2006)
 - Toon Verwaest reported that there are servers that send the Content-Range:
   header in a third, not suppported by libcurl, format and we agreed that we
index cb60c5887d1136b95feef0b93474085bb4e1b149..28cf5837fe8453ab96224cb4c9ee801cafecf627 100644 (file)
@@ -26,6 +26,7 @@ This release includes the following bugfixes:
  o HTTP responses on persistent connections without Content-Length nor chunked
    encoding are now considered to be without response body
  o Content-Range: header parsing improved
+ o CPU 100% load when upload connection broke
 
 Other curl-related news:
 
@@ -42,6 +43,7 @@ This release would not have looked like this without help, code, reports and
 advice from friends like these:
 
  James Housley, Olaf Stueben, Yang Tse, Gisle Vanem, Bradford Bruce,
- Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella, Toon Verwaest
+ Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella, Toon Verwaest,
+ Matt Witherspoon
 
         Thanks! (and sorry if I forgot to mention someone)
index b25067b6cc0828d7c7ec9b43f25ef40cf6f43769..672e5b8cfdc7d3aef298dbf930180c147c3d6fe0 100644 (file)
@@ -124,7 +124,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
   if (writefd != CURL_SOCKET_BAD) {
     if (pfd[num].revents & POLLOUT)
       ret |= CSELECT_OUT;
-    if (pfd[num].revents & POLLERR)
+    if (pfd[num].revents & (POLLERR|POLLHUP))
       ret |= CSELECT_ERR;
   }