public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "bernd.edlinger at hotmail dot de" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug threads/31602] New: Sporadic test failures in gdb.threads/signal-command-handle-nopass.exp
Date: Wed, 03 Apr 2024 19:16:24 +0000	[thread overview]
Message-ID: <bug-31602-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=31602

            Bug ID: 31602
           Summary: Sporadic test failures in
                    gdb.threads/signal-command-handle-nopass.exp
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: threads
          Assignee: unassigned at sourceware dot org
          Reporter: bernd.edlinger at hotmail dot de
  Target Milestone: ---

I observe a 1 out of 10-20 test failure in
gdb.threads/signal-command-handle-nopass.exp
on host system: devuan Daedalus with
Linux version 6.1.0-18-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian
12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP
PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01)
while make check-gdb
RUNTESTFLAGS="gdb.threads/signal-command-handle-nopass.exp"; do :; done
stops always after a few repeates with a failure break in the handler as
follows:

FAIL: gdb.threads/signal-command-handle-nopass.exp: step-over yes: signal
SIGUSR1

                === gdb Summary ===

# of expected passes            16
# of unexpected failures        1
/home/ed/gnu/gdb-build-1/gdb/gdb version  15.0.50.20240401-git -nw -nx -q -iex
"set height 0" -iex "set width 0" -data-directory
/home/ed/gnu/gdb-build-1/gdb/data-directory 

                === gdb Summary ===

# of expected passes            16
# of unexpected failures        1
/home/ed/gnu/gdb-build-1/gdb/gdb version  15.0.50.20240401-git -nw -nx -q -iex
"set height 0" -iex "set width 0" -data-directory
/home/ed/gnu/gdb-build-1/gdb/data-directory 

make[3]: *** [Makefile:226: do-check-single] Error 1
make[3]: Leaving directory '/home/ed/gnu/gdb-build-1/gdb/testsuite'
make[2]: *** [Makefile:161: check] Error 2
make[2]: Leaving directory '/home/ed/gnu/gdb-build-1/gdb/testsuite'
make[1]: *** [Makefile:1969: check] Error 2
make[1]: Leaving directory '/home/ed/gnu/gdb-build-1/gdb'
make: *** [Makefile:12412: check-gdb] Error 2

Failure happens both with step over and without.

log file shows this when the failure happens:

(gdb) PASS: gdb.threads/signal-command-handle-nopass.exp: step-over yes: thread
1 selected 
signal SIGUSR1^M 
Continuing with signal SIGUSR1.^M 
^M 
Thread 1 "signal-command-" received signal SIGUSR1, User defined signal 1.^M 
0x00007ffff7e59847 in pthread_create () from /lib/x86_64-linux-gnu/libc.so.6^M 
(gdb) FAIL: gdb.threads/signal-command-handle-nopass.exp: step-over yes: signal
SIGUSR1 
info threads^M 
  Id   Target Id                                           Frame ^M 
* 1    Thread 0x7ffff7dcd740 (LWP 28333) "signal-command-" 0x00007ffff7e59847
in pthread_create () from /lib/x86_64-linux-gnu/libc.so.6^M 
  2    Thread 0x7ffff7dcc6c0 (LWP 28336) "signal-command-" thread_function
(arg=0x0) at
/home/ed/gnu/gdb-build-1/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c:34^M 
(gdb) PASS: gdb.threads/signal-command-handle-nopass.exp: step-over yes: thread
1 got the signal 

Expected behavior would be break in handler, not in pthread_create.
Even if I modify the test case to continue there and wait for the breakpoint to
be hit later, that does not happen.  It looks like the pthread_create catches
the SIGUSR1.

The problem seems to go away if I change the test to allow the pthread_create
to complete before the first breakpoint is hit as follows:

diff --git a/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c
b/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c
index 6d82bd6f256..9e065ec5303 100644
--- a/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c
+++ b/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c
@@ -35,6 +35,13 @@ thread_function (void *arg)
     usleep (1);
 }

+void *
+thread_function1 (void *arg)
+{
+  usleep (10);
+  return thread_function (arg);
+}
+
 int
 main (void)
 {
@@ -42,7 +49,7 @@ main (void)
   int i;

   signal (SIGUSR1, handler);
-  pthread_create (&child_thread, NULL, thread_function, NULL);
+  pthread_create (&child_thread, NULL, thread_function1, NULL);
   pthread_join (child_thread, NULL);

   return 0;

Well it looks a bit as if the pthread_create is broken here.
And probably a KFAIL would be more appropriate?

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

                 reply	other threads:[~2024-04-03 19:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=bug-31602-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).