]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
debuginfod: Use DEBUGINFOD_TIMEOUT as seconds to get at least 100K.
authorMark Wielaard <mark@klomp.org>
Thu, 2 Jan 2020 16:02:42 +0000 (17:02 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 9 Jan 2020 23:12:00 +0000 (00:12 +0100)
Use just one timeout using CURLOPT_LOW_SPEED_TIME (default 90 seconds)
and CURLOPT_LOW_SPEED_LIMIT (100K).

Signed-off-by: Mark Wielaard <mark@klomp.org>
debuginfod/ChangeLog
debuginfod/debuginfod-client.c
doc/ChangeLog
doc/debuginfod-find.1
doc/debuginfod.8
doc/debuginfod_find_debuginfo.3
tests/ChangeLog
tests/run-debuginfod-find.sh

index 6cfb4e240301f35be7646d52f3dbfc174350446d..1877852144afefd5221c1174d39a11d4ea82aed2 100644 (file)
@@ -1,3 +1,11 @@
+2019-01-02  Mark Wielaard  <mark@klomp.org>
+
+       * debuginfod.cxx (default_connect_timeout): Removed.
+       (default_transfer_timeout): Removed.
+       (default_timeout): New. Default to 90 seconds.
+       (debuginfod_query_server): Parse server_timeout_envvar as one number.
+       Set as CURLOPT_LOW_SPEED_TIME, with CURL_OPT_LOW_SPEED_LIMITE as 100K.
+
 2020-01-09  Frank Ch. Eigler  <fche@redhat.com>
 
        * debuginfod-client.c (add_extra_headers): New function,
index 66ccb21ae6d987a59c461833e97675874ce232cb..e5a2e824f7fe0c00c145b227c8380a7f79946049 100644 (file)
@@ -105,10 +105,9 @@ static const char *server_urls_envvar = DEBUGINFOD_URLS_ENV_VAR;
 static const char *url_delim =  " ";
 static const char url_delim_char = ' ';
 
-/* Timeout for debuginfods, in seconds. */
+/* Timeout for debuginfods, in seconds (to get at least 100K). */
 static const char *server_timeout_envvar = DEBUGINFOD_TIMEOUT_ENV_VAR;
-static const long default_connect_timeout = 5;
-static const long default_transfer_timeout = -1; /* unlimited */
+static const long default_timeout = 90;
 
 
 /* Data associated with a particular CURL easy handle. Passed to
@@ -483,18 +482,10 @@ debuginfod_query_server (debuginfod_client *c,
       return fd;
     }
 
-  long connect_timeout = default_connect_timeout;
-  long transfer_timeout = default_transfer_timeout;
+  long timeout = default_timeout;
   const char* timeout_envvar = getenv(server_timeout_envvar);
   if (timeout_envvar != NULL)
-    {
-      long ct, tt;
-      rc = sscanf(timeout_envvar, "%ld,%ld", &ct, &tt);
-      if (rc >= 1)
-        connect_timeout = ct;
-      if (rc >= 2)
-        transfer_timeout = tt;
-    }
+    timeout = atoi (timeout_envvar);
 
   /* make a copy of the envvar so it can be safely modified.  */
   server_urls = strdup(urls_envvar);
@@ -586,10 +577,15 @@ debuginfod_query_server (debuginfod_client *c,
                        CURLOPT_WRITEFUNCTION,
                        debuginfod_write_callback);
       curl_easy_setopt(data[i].handle, CURLOPT_WRITEDATA, (void*)&data[i]);
-      if (connect_timeout >= 0)
-        curl_easy_setopt(data[i].handle, CURLOPT_CONNECTTIMEOUT, connect_timeout);
-      if (transfer_timeout >= 0)
-        curl_easy_setopt(data[i].handle, CURLOPT_TIMEOUT, transfer_timeout);
+      if (timeout > 0)
+       {
+         /* Make sure there is at least some progress,
+            try to get at least 100K per timeout seconds.  */
+         curl_easy_setopt (data[i].handle, CURLOPT_LOW_SPEED_TIME,
+                           timeout);
+         curl_easy_setopt (data[i].handle, CURLOPT_LOW_SPEED_LIMIT,
+                           100 * 1024L);
+       }
       curl_easy_setopt(data[i].handle, CURLOPT_FILETIME, (long) 1);
       curl_easy_setopt(data[i].handle, CURLOPT_FOLLOWLOCATION, (long) 1);
       curl_easy_setopt(data[i].handle, CURLOPT_FAILONERROR, (long) 1);
index 1422766d07d39f3721734953bb65effc72b9b881..b40a141b155469c26534e9afdfb82051003f816a 100644 (file)
@@ -1,3 +1,10 @@
+2020-01-02  Mark Wielaard  <mark@klomp.org>
+
+       * debuginfod.8 (DEBUGINFOD_TIMEOUT): Document as seconds to
+       provide 100K, default 90.
+       * debuginfod-find.1 (DEBUGINFOD_TIMEOUT): Likewise.
+       * debuginfod_find_debuginfo.3 (DEBUGINFOD_TIMEOUT): Likewise.
+
 2019-12-22  Frank Ch. Eigler  <fche@redhat.com
 
        * debuginfod.8: Add -U (DEB) flag, generalize RPM to "archive".
index 023acbb3b722e908946ea1501379cdeda063bb4c..e71ca29be96ecf943556a7f138160a0c25d0b3dd 100644 (file)
@@ -119,13 +119,10 @@ debuginfod instances.  Alternate URL prefixes are separated by space.
 
 .TP 21
 .B DEBUGINFOD_TIMEOUT
-This environment variable governs the timeouts for each debuginfod
-HTTP connection.  One or two comma-separated numbers may be given.
-The first is the number of seconds for the connection establishment
-(CURLOPT_CONNECTTIMEOUT), and the default is 5.  The second is the
-number of seconds for the transfer completion (CURLOPT_TIMEOUT), and
-the default is no timeout.  (Zero or negative also means "no
-timeout".)
+This environment variable governs the timeout for each debuginfod HTTP
+connection.  A server that fails to provide at least 100K of data
+within this many seconds is skipped. The default is 90 seconds.  (Zero
+or negative means "no timeout".)
 
 .TP 21
 .B DEBUGINFOD_CACHE_PATH
index 342f524c7921053bcd05e5293759d307caff0098..6184bccefe4e6262a2863125b89da1d701a01deb 100644 (file)
@@ -366,8 +366,10 @@ or indirectly - the results would be hilarious.
 .TP 21
 .B DEBUGINFOD_TIMEOUT
 This environment variable governs the timeout for each debuginfod HTTP
-connection.  A server that fails to respond within this many seconds
-is skipped.  The default is 5.
+connection.  A server that fails to provide at least 100K of data
+within this many seconds is skipped. The default is 90 seconds.  (Zero
+or negative means "no timeout".)
+
 
 .TP 21
 .B DEBUGINFOD_CACHE_PATH
index ea8c61612924e8c2980a4ff8a7166f23843237f0..f6ea7a4590a966429adeac63d90efed5a3a1427f 100644 (file)
@@ -163,13 +163,10 @@ debuginfod instances.  Alternate URL prefixes are separated by space.
 
 .TP 21
 .B DEBUGINFOD_TIMEOUT
-This environment variable governs the timeouts for each debuginfod
-HTTP connection.  One or two comma-separated numbers may be given.
-The first is the number of seconds for the connection establishment
-(CURLOPT_CONNECTTIMEOUT), and the default is 5.  The second is the
-number of seconds for the transfer completion (CURLOPT_TIMEOUT), and
-the default is no timeout.  (Zero or negative also means "no
-timeout".)
+This environment variable governs the timeout for each debuginfod HTTP
+connection.  A server that fails to provide at least 100K of data
+within this many seconds is skipped. The default is 90 seconds.  (Zero
+or negative means "no timeout".)
 
 .TP 21
 .B DEBUGINFOD_PROGRESS
index 02a8f75fe0efc48696e3fbea827755d808b50bf0..2638f63c42bb745f2135511844b0579cbaee2acc 100644 (file)
@@ -1,3 +1,7 @@
+2020-01-02  Mark Wielaard  <mark@klomp.org>
+
+       * run-debuginfod-find.sh: Set DEBUGINFOD_TIMEOUT to 10.
+
 2019-12-22  Frank Ch. Eigler  <fche@redhat.com>
 
        * debuginfod-debs/*: New test files, based on
index 90dafe00f50c5200f86407858974b049dacad448..4ab47a3100b6e738691b1198575f5ac85fcd8dd6 100755 (executable)
@@ -94,7 +94,7 @@ wait_ready $PORT1 'ready' 1
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1/   # or without trailing /
 
 # Be patient when run on a busy machine things might take a bit.
-export DEBUGINFOD_TIMEOUT=1,10
+export DEBUGINFOD_TIMEOUT=10
 
 # We use -t0 and -g0 here to turn off time-based scanning & grooming.
 # For testing purposes, we just sic SIGUSR1 / SIGUSR2 at the process.