public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [gdb/testsuite] Fix hang in fork-running-state.c
Date: Wed, 13 Jun 2018 12:10:00 -0000	[thread overview]
Message-ID: <21cb1f1d-fad1-e9c5-a106-b0b67a1f7a50@redhat.com> (raw)
In-Reply-To: <20180612155134.7fninj4us5lq4hfc@localhost.localdomain>

On 06/12/2018 04:51 PM, Tom de Vries wrote:

> ...
> So, AFAIU, the hanging process is the child process that gdb detaches from.
> 
> There's an alarm set in main before the fork, but alarms are not preserved in
> the fork child:
> ...
> $ man alarm
>    ...
> NOTES
>        Alarms created by alarm() are preserved across execve(2) and are not inherited by children created via fork(2).

Whoops.

> ...
> So, AFAIU, once the parent is killed, there's no alarm to terminate the child.

Indeed.

Your patch is definitely a good idea.  Please push.

However, I think that still leaves an unnecessary delay until
the detached child/parent terminate.  They used to exit themselves,
but that caused a race, so they no longer do, see here:

 https://sourceware.org/ml/gdb-patches/2018-03/msg00588.html

Sounds like the best would be to restore the self-killing,
but make it controlled by a variable that gdb sets, depending
on whether gdb is staying attached to the child/parent.

Thanks,
Pedro Alves

  reply	other threads:[~2018-06-13 12:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 15:51 Tom de Vries
2018-06-13 12:10 ` Pedro Alves [this message]
2018-06-14 12:59   ` [PATCH] Avoid gdb.base/fork-running-state.exp lingering processes (Re: [gdb/testsuite] Fix hang in fork-running-state.c) Pedro Alves
2018-06-14 16:07     ` Tom de Vries
2018-06-14 16:44       ` Pedro Alves

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=21cb1f1d-fad1-e9c5-a106-b0b67a1f7a50@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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).