From b31e5e1a15eab714996ef02fcc7421ab778d91c8 Mon Sep 17 00:00:00 2001 From: Walt Gribben Date: Tue, 9 May 2006 02:00:04 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=10115 --- checkin_notes | 8 ++++++++ client/client_state.C | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/checkin_notes b/checkin_notes index b3986d6ae8..aa66895179 100755 --- a/checkin_notes +++ b/checkin_notes @@ -4540,3 +4540,11 @@ Charlie 8 May 2006 api/ x_opengl.C + +Walt 8 May 2006 + - Bug fix: DNS lookup when network was unavailable consumed all + available CPU. Fix limits times thru loop and adds a short + sleep before breaking out of it. + + client/ + client_state..C diff --git a/client/client_state.C b/client/client_state.C index ed887bbe72..2486af3c08 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -362,6 +362,7 @@ void CLIENT_STATE::do_io_or_sleep(double x) { struct timeval tv; now = dtime(); double end_time = now + x; + int loops = 0; while (1) { curl_fds.zero(); @@ -387,6 +388,15 @@ void CLIENT_STATE::do_io_or_sleep(double x) { if (n==0) break; + // Limit number of times thru this loop. Can get + // stuck in while loop, if network isn't available, + // DNS lookups tend to eat CPU cycles. + // + if (loops++ > 99) { + boinc_sleep(.01); + break; + } + now = dtime(); if (now > end_time) break; x = end_time - now;