public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Noah Sanci <nsanci@redhat.com>
Cc: elfutils-devel@sourceware.org
Subject: Re: [Bug debuginfod/27983] ignore duplicate urls
Date: Wed, 14 Jul 2021 18:36:13 +0200	[thread overview]
Message-ID: <YO8Sffae5F9TtdLm@wildebeest.org> (raw)
In-Reply-To: <CAJXA7qi9icBD-fiz9M9s1VsOethdAzDy9Yg7H4Nr-CFMeVFKsQ@mail.gmail.com>

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


  reply	other threads:[~2021-07-14 16:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 19:12 Noah Sanci
2021-07-14 16:36 ` Mark Wielaard [this message]
2021-07-19 13:31   ` Noah Sanci
2021-07-20 14:42     ` Mark Wielaard
2021-07-22 16:25       ` Noah Sanci
2021-07-22 19:22         ` Noah Sanci
2021-07-23 18:34           ` Mark Wielaard
2021-07-26 16:29             ` Noah Sanci
2021-07-28 14:55               ` Mark Wielaard
2021-07-28 16:23                 ` Noah Sanci
2021-07-29 12:20                   ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YO8Sffae5F9TtdLm@wildebeest.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=nsanci@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).