Bug 33905 - show_backtrace hangs on SIGSEGV in malloc/free
Summary: show_backtrace hangs on SIGSEGV in malloc/free
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-26 12:12 UTC by Toon Moene
Modified: 2011-05-17 21:07 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Toon Moene 2007-10-26 12:12:08 UTC
The current implementation of show_backtrace hangs on a mutex lock in the malloc/free routines when a segmentation fault due to corruption of the malloc/free administration happens to trigger the backtrace.

There is an alternative implementation using a temporary file to store the translation of address -> symbol name that doesn't malloc storage (see 'man backtrace').

A work around is to force the hanging process to the background and using the "attach" functionality of gdb to force a backtrace with the "where" command.
Comment 1 Francois-Xavier Coudert 2009-03-29 09:18:08 UTC
Toon, do you have an example that shows this happening?
Comment 2 Toon Moene 2009-03-29 13:36:33 UTC
I'll try to come up with a bug report this week (the original case is much to complicated to use as an example).

However, it might take some time and it also might be system dependent to trigger this event.

It's clear, however, from the way you implemented the traceback feature that it is possible to hit this snag - it's just that not many people will hit it.
Comment 3 Francois-Xavier Coudert 2009-05-13 09:03:13 UTC
Frankly, this is a snag in a non-default debugging feature in rare conditions; that has to be a third-order enhancement request, at least! :)  We cannot provide completely foolproof debugging capablities anyway: people who want to have the full power of debugging will be able to use gdb themselves. (Even with a temporary file, other things can go wrong!)

I'd be in favour of closing this as WONTFIX, unless we have serious indication that this actually happens often in non mixed-language cases. Toon, what's your take?
Comment 4 Paul Thomas 2009-12-17 20:17:27 UTC
I think that FX was right, since Toon has not responded in 6 months.

Entering a WONTFIX

Paul
Comment 5 Toon Moene 2009-12-17 21:58:58 UTC
> (Even with a temporary file, other things can go wrong!)

Paul, you are right - I agree with FX, but forgot to reply.

Closing as WONTFIX is OK with me.
Comment 6 Tobias Burnus 2011-05-17 21:07:38 UTC
Suggested patch by Janne (cf. PR 48931):
  http://gcc.gnu.org/ml/fortran/2011-05/msg00122.html