From: Jakub Jelinek <jakub@redhat.com>
To: Andrew Stubbs <ams@codesourcery.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libgomp: fix hang on fatal error
Date: Wed, 19 Oct 2022 18:08:34 +0200 [thread overview]
Message-ID: <Y1AhAqwV0TlAjEGX@tucnak> (raw)
In-Reply-To: <Y0/7WLIcxi0c1Mth@tucnak>
On Wed, Oct 19, 2022 at 03:27:52PM +0200, Jakub Jelinek via Gcc-patches wrote:
> > --- a/libgomp/error.c
> > +++ b/libgomp/error.c
> > @@ -77,7 +77,7 @@ void
> > gomp_vfatal (const char *fmt, va_list list)
> > {
> > gomp_verror (fmt, list);
> > - exit (EXIT_FAILURE);
> > + abort ();
> > }
> >
> > void
>
> I don't like this, abort has quite different user visible behavior
> from exit, e.g. the former often dumps core.
>
> I believe in most places libgomp handles this by releasing locks before
> calling gomp_{,v}fatal:
> gomp_mutex_unlock (®ister_lock);
> gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size);
>
> gomp_mutex_unlock (&devicep->lock);
> gomp_fatal ("Copying of %s object [%p..%p) to %s object [%p..%p) failed",
> src, srcaddr, srcaddr + size, dst, dstaddr, dstaddr + size);
>
> etc.
> I could live with a gomp_fatal/gomp_vfatal alternative that would
> use _exit/_Exit (but not sure if it is supported on all targets where
> libgomp is) for uses where releasing locks is for whatever reason
> not an option.
Or yet another possibility would be not use gomp_fatal from within the
plugins, but use gomp_error instead and through possibly adjusted plugin
APIs tell libgomp that there was a fatal error and let libgomp unlock
anything that needs unlocking and exit (EXIT_FAILURE); afterwards.
Jakub
prev parent reply other threads:[~2022-10-19 16:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 17:04 Andrew Stubbs
2022-10-19 13:27 ` Jakub Jelinek
2022-10-19 16:08 ` Jakub Jelinek [this message]
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=Y1AhAqwV0TlAjEGX@tucnak \
--to=jakub@redhat.com \
--cc=ams@codesourcery.com \
--cc=gcc-patches@gcc.gnu.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).