[Bug debuginfod/27983] ignore duplicate urls

Mark Wielaard mark@klomp.org
Wed Jul 14 16:36:13 GMT 2021


Hi Noah,

On Fri, Jul 09, 2021 at 03:12:18PM -0400, Noah Sanci via Elfutils-devel wrote:

> From e37f49a0fd5f27907584b19336cd250d825acc98 Mon Sep 17 00:00:00 2001
> From: Noah Sanci <nsanci@redhat.com>
> Date: Fri, 9 Jul 2021 14:53:10 -0400
> Subject: [PATCH] debuginfod: PR27983 - ignore duplicate urls
> 
> Gazing at server logs, one sees a minority of clients who appear to have
> duplicate query traffic coming in: the same URL, milliseconds apart.
> Chances are the user accidentally doubled her $DEBUGINFOD_URLS somehow,
> and the client library is dutifully asking the servers TWICE. Bug #27863
> reduces the pain on the servers' CPU, but dupe network traffic is still
> being paid.  We should reject sending outright duplicate concurrent
> traffic.
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=27983
> 
> Signed-off-by: Noah Sanci <nsanci@redhat.com>
> ---
>  debuginfod/ChangeLog           |  7 +++++
>  debuginfod/debuginfod-client.c | 56 +++++++++++++++++++++++++---------
>  tests/ChangeLog                |  5 +++
>  tests/run-debuginfod-find.sh   | 13 ++++++++
>  4 files changed, 67 insertions(+), 14 deletions(-)
> 
> diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
> index d9d11737..24ccb8ef 100644
> --- a/debuginfod/ChangeLog
> +++ b/debuginfod/ChangeLog
> @@ -1,3 +1,10 @@
> +2021-07-09  Noah Sanci  <nsanci@redhat.com>
> +
> +	* debuginfod-client.c (debuginfod_query_server): As full-length
> +	urls are generated with standardized formats, ignore duplicates.
> +	Also update the number of urls to the unduplicated number of
> +	urls.

You deduplicate the full URLs after they are fully constructed.  Would
it make sense to do the deduplication on server_url, maybe even as
part of the Count number of URLs code? That might make the code
simpler. And you can change num_urls upfront.

> +  num_urls = unduplicated_urls;
> +  data = reallocarray( (void *) data, num_urls, sizeof(struct handle_data));

Maybe this reallocarray is unnecessary. Yes, it might save a little
bit of memory, but you do have to handle reallocarray failure.

Cheers,

Mark



More information about the Elfutils-devel mailing list