PATCH: debuginfod thread naming

2021-03-30 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

Planning to merge this as obvious.


Author: Frank Ch. Eigler 
Date:   Tue Mar 30 13:22:43 2021 -0400

debuginfod: Set child thread names via pthread_setname_np()

In order to assist problem diagnosis / monitoring, use this
gnu-flavoured pthread function to set purpose names to the various
child threads debuginfod starts.  libmicrohttpd already sets this for
its threads.

Signed-off-by: Frank Ch. Eigler 

diff --git a/ChangeLog b/ChangeLog
index fe7e8498e871..e18746fb9771 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-30  Frank Ch. Eigler  
+
+   * configure.ac: Look for pthread_setname_np.
+
 2021-02-17  Timm Bäder  
 
* configure.ac: Add -Wno-packed-not-aligned check.
diff --git a/configure.ac b/configure.ac
index aa8439e82b75..ad046bc27ac1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -747,6 +747,9 @@ AS_IF([test "x$enable_libdebuginfod" != "xno"], [
 fi
 ])
 
+AC_CHECK_LIB(pthread, pthread_setname_np, [
+  AC_DEFINE([HAVE_PTHREAD_SETNAME_NP],[1],[Enable 
pthread_setname_np])])
+
 AS_IF([test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" 
= "xdummy"],
   [AC_DEFINE([ENABLE_LIBDEBUGINFOD], [1], [Enable libdebuginfod])])
 AS_IF([test "x$enable_libdebuginfod" = "xdummy"],
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 56c2ec2b33fb..c98a8374732b 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-30  Frank Ch. Eigler 
+
+   * debuginfod.cxx (main): Set child thread names.
+
 2021-03-07  Timm Bäder 
 
* debuginfod-client.c (debuginfod_query_server): Tweak
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 2aecc0494062..473511eab921 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3473,23 +3473,35 @@ main (int argc, char *argv[])
   if (rc)
 error (EXIT_FAILURE, rc, "cannot spawn thread to groom database\n");
   else
-all_threads.push_back(pt);
+{
+#ifdef HAVE_PTHREAD_SETNAME_NP
+  (void) pthread_setname_np (pt, "groom");
+#endif
+  all_threads.push_back(pt);
+}
 
   if (scan_files || scan_archives.size() > 0)
 {
   rc = pthread_create (& pt, NULL, thread_main_fts_source_paths, NULL);
   if (rc)
 error (EXIT_FAILURE, rc, "cannot spawn thread to traverse source 
paths\n");
+#ifdef HAVE_PTHREAD_SETNAME_NP
+  (void) pthread_setname_np (pt, "traverse");
+#endif
   all_threads.push_back(pt);
+
   for (unsigned i=0; i
+
+   * run-debuginfod-find.sh: Add thread comm checks.
+
 2021-02-17  Timm Bäder  
 
* elfstrmerge.c (main): Move new_data_buf function to...
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
index bcca61301b2b..8213c8a42877 100755
--- a/tests/run-debuginfod-find.sh
+++ b/tests/run-debuginfod-find.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright (C) 2019-2020 Red Hat, Inc.
+# Copyright (C) 2019-2021 Red Hat, Inc.
 # This file is part of elfutils.
 #
 # This file is free software; you can redistribute it and/or modify
@@ -113,6 +113,11 @@ 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=10
 
+# Check thread comm names
+ps -q $PID1 -e -L -o '%p %c %a' | grep groom
+ps -q $PID1 -e -L -o '%p %c %a' | grep scan
+ps -q $PID1 -e -L -o '%p %c %a' | grep traverse
+
 # We use -t0 and -g0 here to turn off time-based scanning & grooming.
 # For testing purposes, we just sic SIGUSR1 / SIGUSR2 at the process.
 



[Bug debuginfod/27277] support HEAD query for debuginfod content probe requests

2021-03-30 Thread fche at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27277

--- Comment #2 from Frank Ch. Eigler  ---
A related idea:
extend the webapi so that returned content includes response headers that
identify the archive & file name where the content was extracted from.
For server privacy, maybe pass back just the basename.  The client API
would need to be extended to store those headers as extra strings a client
could query.

All this can be used by smarter clients to identify in user-friendly ways the
origin of the buildid.  For example:

 % debuginfod-find describe BUILDID
 [runs HEAD query, listens to extra Headers]
 length: 2879342938423 
 server: https://foo/bar
 x-archive: foo-bar-2.3.rpm
 x-file: bin/sudifusdf

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/27669] New: extend webapi for partial match source queries

2021-03-30 Thread fche at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27669

Bug ID: 27669
   Summary: extend webapi for partial match source queries
   Product: elfutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: debuginfod
  Assignee: unassigned at sourceware dot org
  Reporter: fche at redhat dot com
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

It may be desirable to fetch source files by buildid and __FILE__ name only, as
these can be introspectively extracted sometimes from a running program image,
without DWARF comp_dir etc. work.

It could look like this:

   /buildid/HEXCODE/source*/PARTIAL_PATH

and implement the search by using a sql LIKE operator

   artifactsrc like '%PARTIAL_PATH'

in the mhd-query-s block of handle_buildid()

-- 
You are receiving this mail because:
You are on the CC list for the bug.