public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11644] New: Hang in throw when unloading a library
@ 2003-07-23 12:12 peter dot rost at freenet dot de
2003-07-23 12:17 ` [Bug c++/11644] " peter dot rost at freenet dot de
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: peter dot rost at freenet dot de @ 2003-07-23 12:12 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
Summary: Hang in throw when unloading a library
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peter dot rost at freenet dot de
CC: gcc-bugs at gcc dot gnu dot org
hello,
i found the following which doesn't appears in g++-2.95 but in g++-3.2 and
g++3.3. i'm using debian-linux with the gcc-version 3.3.1 20030626 (Debian
prerelease). the situation is as follows:
i wrote a main program which loads a library and calls a function (defined in
the library) which creates some threads. after a few seconds the main program
tries to unload the library. hence the __fini_lib-function will be called and
tries to finish all threads. but one of these threads throws an exception. and
this throw-call hangs (it wion't be catched!) incl. the rest of the program;)
peter.
the gdb-output of this hang looks like:
#0 0x40150ea9 in sigsuspend () from /lib/libc.so.6
#1 0x4003cd48 in __pthread_wait_for_restart_signal () from /lib/libpthread.so.0
#2 0x4003e9ab in __pthread_lock () from /lib/libpthread.so.0
#3 0x4003b1c8 in pthread_mutex_lock () from /lib/libpthread.so.0
#4 0x4021eb7c in dl_iterate_phdr () from /lib/libc.so.6
#5 0x40124de7 in _Unwind_Find_FDE () from /lib/libgcc_s.so.1
#6 0x40122bd9 in uw_frame_state_for () from /lib/libgcc_s.so.1
#7 0x401230aa in uw_init_context_1 () from /lib/libgcc_s.so.1
#8 0x40123308 in _Unwind_RaiseException () from /lib/libgcc_s.so.1
#9 0x400d4799 in __cxa_throw () from /usr/lib/libstdc++.so.5
#10 0x400207e8 in ?? ()
#11 0x40021006 in ?? ()
#12 0x40020dea in ?? ()
#13 0x4003a1b0 in pthread_start_thread () from /lib/libpthread.so.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
@ 2003-07-23 12:17 ` peter dot rost at freenet dot de
2003-07-23 18:45 ` pinskia at physics dot uc dot edu
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: peter dot rost at freenet dot de @ 2003-07-23 12:17 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
------- Additional Comments From peter dot rost at freenet dot de 2003-07-23 12:17 -------
Created an attachment (id=4466)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4466&action=view)
Sample source code which will hang using g++-3.3 but not using 2.95
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
2003-07-23 12:17 ` [Bug c++/11644] " peter dot rost at freenet dot de
@ 2003-07-23 18:45 ` pinskia at physics dot uc dot edu
2003-07-23 19:24 ` peter dot rost at freenet dot de
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-23 18:45 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-23 18:45 -------
I think unloading a c++ library is not supported.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
2003-07-23 12:17 ` [Bug c++/11644] " peter dot rost at freenet dot de
2003-07-23 18:45 ` pinskia at physics dot uc dot edu
@ 2003-07-23 19:24 ` peter dot rost at freenet dot de
2003-08-11 12:42 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: peter dot rost at freenet dot de @ 2003-07-23 19:24 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
------- Additional Comments From peter dot rost at freenet dot de 2003-07-23 19:24 -------
Subject: Re: Hang in throw when unloading a library
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
but how could it be, that the throw-statement isn't supported anymore
after the unload of the library has began!?
On Wed, 23 Jul 2003, pinskia at physics dot uc dot edu wrote:
> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
>
>
>
> ------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-23 18:45 -------
> I think unloading a c++ library is not supported.
>
>
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/HuDBoX1lKJAtNVgRApSuAJ9j0PH8hNQxDcL+kBPLtcTjZU/yZwCgoZ50
kywuWNtN52Ti/67pmpe8GjU=
=gTHv
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
` (2 preceding siblings ...)
2003-07-23 19:24 ` peter dot rost at freenet dot de
@ 2003-08-11 12:42 ` pinskia at gcc dot gnu dot org
2003-08-19 15:15 ` lerdsuwa at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-11 12:42 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4 |---
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
` (3 preceding siblings ...)
2003-08-11 12:42 ` pinskia at gcc dot gnu dot org
@ 2003-08-19 15:15 ` lerdsuwa at gcc dot gnu dot org
2003-08-19 15:32 ` peter dot rost at freenet dot de
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-08-19 15:15 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-08-19 15:15 -------
Two possible problems that make your code not working:
1 You need g++ and libstdc++ that are thread-enabled.
See this link for more info
http://gcc.gnu.org/bugs.html#nonbugs_cxx
2 The exception is thrown inside __fini_lib through the
function call chain:
main -> unloadLib -> dlclose -> __fini_Lib
If the dlclose in your C library is not built with
exception unwinding, thrown exception cannot propagate
back to main.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
` (4 preceding siblings ...)
2003-08-19 15:15 ` lerdsuwa at gcc dot gnu dot org
@ 2003-08-19 15:32 ` peter dot rost at freenet dot de
2003-08-24 9:42 ` lerdsuwa at users dot sourceforge dot net
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: peter dot rost at freenet dot de @ 2003-08-19 15:32 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
------- Additional Comments From peter dot rost at freenet dot de 2003-08-19 15:32 -------
Subject: Re: Hang in throw when unloading a library
well, it sounds good, but
1. how can i determine if my dlclose is built with/without exception
unwinding?
2. for me it's very mysterious, that the debian-compiled-version of gcc 2.95
doesnot have any problems with but gcc 3.x has them!? so, are there some more
changes at dlclose which can produce the behaviour?
thanks a lot for your help, peter.
On Tuesday 19 August 2003 17:15, you wrote:
> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
>
>
>
> ------- Additional Comments From lerdsuwa at gcc dot gnu dot org
> 2003-08-19 15:15 ------- Two possible problems that make your code not
> working:
>
> 1 You need g++ and libstdc++ that are thread-enabled.
> See this link for more info
> http://gcc.gnu.org/bugs.html#nonbugs_cxx
>
> 2 The exception is thrown inside __fini_lib through the
> function call chain:
> main -> unloadLib -> dlclose -> __fini_Lib
> If the dlclose in your C library is not built with
> exception unwinding, thrown exception cannot propagate
> back to main.
>
>
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
` (5 preceding siblings ...)
2003-08-19 15:32 ` peter dot rost at freenet dot de
@ 2003-08-24 9:42 ` lerdsuwa at users dot sourceforge dot net
2003-08-24 14:36 ` lerdsuwa at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: lerdsuwa at users dot sourceforge dot net @ 2003-08-24 9:42 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
------- Additional Comments From lerdsuwa at users dot sourceforge dot net 2003-08-24 09:42 -------
Subject: Re: Hang in throw when unloading a library
You can use GCC option -fexceptions during compilation of
C code to make it support exception unwinding. But after
looking at the glibc dlcose source code, I think throwing
exception through this function could leave some glibc
internal data structure messed up. You should catch all
exceptions in your library __fini_Lib instead.
--Kriang
Peter Rost wrote:
>well, it sounds good, but
>
>
>1. how can i determine if my dlclose is built with/without exception
>unwinding?
>2. for me it's very mysterious, that the debian-compiled-version of gcc 2.95
>doesnot have any problems with but gcc 3.x has them!? so, are there some more
>changes at dlclose which can produce the behaviour?
>
>thanks a lot for your help, peter.
>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
` (6 preceding siblings ...)
2003-08-24 9:42 ` lerdsuwa at users dot sourceforge dot net
@ 2003-08-24 14:36 ` lerdsuwa at gcc dot gnu dot org
2003-09-19 16:00 ` lerdsuwa at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-08-24 14:36 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
lerdsuwa at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-08-24 14:36:22
date| |
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-08-24 14:36 -------
We have a deadlock between glibc functions 'dlclose' and
'dl_iterate_phdr' both rely on the spinlock '_dl_load_lock'.
And glibc doesn't have a recursive lock implementation yet.
This interferes with stack unwinding code in GCC. When
compiled for glibc it currently uses 'dl_iterate_phdr' to
unwind the stack. So user cannon throw exception anywhere
inside library clean up function (called during 'dlclose').
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
` (7 preceding siblings ...)
2003-08-24 14:36 ` lerdsuwa at gcc dot gnu dot org
@ 2003-09-19 16:00 ` lerdsuwa at gcc dot gnu dot org
2003-10-04 10:53 ` peter dot rost at freenet dot de
2003-12-06 8:31 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-09-19 16:00 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-09-19 15:14 -------
I checked glibc 2.3.2 source code and it uses recursive locks now.
So this issue should be fixed with a glibc upgrade. I am keeping
this around until someone with a new glibc installed can confirm
and this bug report.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
` (8 preceding siblings ...)
2003-09-19 16:00 ` lerdsuwa at gcc dot gnu dot org
@ 2003-10-04 10:53 ` peter dot rost at freenet dot de
2003-12-06 8:31 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: peter dot rost at freenet dot de @ 2003-10-04 10:53 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
------- Additional Comments From peter dot rost at freenet dot de 2003-10-04 10:53 -------
Subject: Re: Hang in throw when unloading a library
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hello, thanks for bug-fix;) but because i'm using debian linux i'm not
so aware of "how to install your fixed glibc-2.3.2"? can you probably
help me with a little bit assistance. thanks a lot, peter.
On Fri, 19 Sep 2003, lerdsuwa at gcc dot gnu dot org wrote:
> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
>
>
>
> ------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-09-19 15:14 -------
> I checked glibc 2.3.2 source code and it uses recursive locks now.
> So this issue should be fixed with a glibc upgrade. I am keeping
> this around until someone with a new glibc installed can confirm
> and this bug report.
>
>
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/fqadoX1lKJAtNVgRAqfRAJ9OzKWcnHrioBFj7FEMJp7Y6ClPBQCgrJ6y
OXH9jszwvoijtp2ISKguzEY=
=sOQz
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/11644] Hang in throw when unloading a library
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
` (9 preceding siblings ...)
2003-10-04 10:53 ` peter dot rost at freenet dot de
@ 2003-12-06 8:31 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-06 8:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-06 08:31 -------
I know that for a fact Carlo Wood have a library that does dlclose that works (at least for non recent
3.4 but that is a different bug and is already filed and is about to be fixed:) ).
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11644
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2003-12-06 8:31 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-23 12:12 [Bug c++/11644] New: Hang in throw when unloading a library peter dot rost at freenet dot de
2003-07-23 12:17 ` [Bug c++/11644] " peter dot rost at freenet dot de
2003-07-23 18:45 ` pinskia at physics dot uc dot edu
2003-07-23 19:24 ` peter dot rost at freenet dot de
2003-08-11 12:42 ` pinskia at gcc dot gnu dot org
2003-08-19 15:15 ` lerdsuwa at gcc dot gnu dot org
2003-08-19 15:32 ` peter dot rost at freenet dot de
2003-08-24 9:42 ` lerdsuwa at users dot sourceforge dot net
2003-08-24 14:36 ` lerdsuwa at gcc dot gnu dot org
2003-09-19 16:00 ` lerdsuwa at gcc dot gnu dot org
2003-10-04 10:53 ` peter dot rost at freenet dot de
2003-12-06 8:31 ` pinskia at gcc dot gnu dot org
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).