* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
@ 2004-09-24 23:44 ` pinskia at gcc dot gnu dot org
2004-09-25 0:52 ` lothar at xcerla dot com
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-24 23:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-24 23:44 -------
Invalid as std::map is not multithreaded that way (you would have the same problem without
_GLIBCXX_DEBUG also as it is not done this way for either). What this is showing you is that you need to
add the write guard other wise you get a crash or wrong answers without _GLIBCXX_DEBUG.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
2004-09-24 23:44 ` [Bug libstdc++/17664] " pinskia at gcc dot gnu dot org
@ 2004-09-25 0:52 ` lothar at xcerla dot com
2004-09-25 0:53 ` lothar at xcerla dot com
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: lothar at xcerla dot com @ 2004-09-25 0:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lothar at xcerla dot com 2004-09-25 00:52 -------
I did some reading in the source and the culprit is that _M_attach,
_M_detach, ... are not thread safe. as iter++ creates a temporary iterator
(that has to attach and detach) and they access the (shared) map, it failes in
the multithreaded case. As these calls are ONLY executed when _GLIBCXX_DEBUG
is defined, the program only fails there.
I think this clearly IS a bug and should be solved by protecting the
_M_attach, _M_detach, ... methods with a mutex.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |VERIFIED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
2004-09-24 23:44 ` [Bug libstdc++/17664] " pinskia at gcc dot gnu dot org
2004-09-25 0:52 ` lothar at xcerla dot com
@ 2004-09-25 0:53 ` lothar at xcerla dot com
2004-09-28 9:59 ` pcarlini at suse dot de
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: lothar at xcerla dot com @ 2004-09-25 0:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lothar at xcerla dot com 2004-09-25 00:52 -------
oops I wanted reopen, not verify
--
What |Removed |Added
----------------------------------------------------------------------------
Status|VERIFIED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (2 preceding siblings ...)
2004-09-25 0:53 ` lothar at xcerla dot com
@ 2004-09-28 9:59 ` pcarlini at suse dot de
2004-10-07 3:53 ` bkoz at gcc dot gnu dot org
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2004-09-28 9:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2004-09-28 09:59 -------
Hi. I agree that something, somewhere, seems fishy in debug mode vs MT: we'll
see... However, your testcase involves ++iter *not* iter++ ;)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (3 preceding siblings ...)
2004-09-28 9:59 ` pcarlini at suse dot de
@ 2004-10-07 3:53 ` bkoz at gcc dot gnu dot org
2004-10-07 16:16 ` lothar at xcerla dot com
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-10-07 3:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2004-10-07 03:53 -------
Lothar, do you have specific source lines, or a patch you can propose? That
would probably speed things up.
Your test program is quite large. Is there anyway to reproduce this without all
of ACE? If so, that also would be useful.
-benjamin
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (4 preceding siblings ...)
2004-10-07 3:53 ` bkoz at gcc dot gnu dot org
@ 2004-10-07 16:16 ` lothar at xcerla dot com
2004-11-01 20:42 ` bkoz at gcc dot gnu dot org
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: lothar at xcerla dot com @ 2004-10-07 16:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lothar at xcerla dot com 2004-10-07 16:16 -------
No, unfortunaltely I had no time to do further work. It is also a lot of work
(at least for me) to replace ACE and use pthreads natively, as ACE provides a
lot of wonderful abstractions (that keep the code shorter than with native
calls). However, if you are on Linux and don't want to compile ACE yourself,
there's packages (deb, rpm) as well. Just google for them. Once you have ACE
compiling and running the example is easy (it contains the compile and link
command lines).
Our "workaround" currently is simply not to use "_GLIBCXX_DEBUG".
I think basically the problem is clear. As the debug versions of the
containers/iterators access some shared data in the MT case (the iterator
(de)registration is one such case) This data has to be protected by a mutex or
something similar. However I had no time to create a patch for the code. As
stated above we just switched to non debug STL for the time being.
Lothar
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (5 preceding siblings ...)
2004-10-07 16:16 ` lothar at xcerla dot com
@ 2004-11-01 20:42 ` bkoz at gcc dot gnu dot org
2004-11-01 20:42 ` bkoz at gcc dot gnu dot org
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-11-01 20:42 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |bkoz at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (6 preceding siblings ...)
2004-11-01 20:42 ` bkoz at gcc dot gnu dot org
@ 2004-11-01 20:42 ` bkoz at gcc dot gnu dot org
2004-11-02 5:48 ` bkoz at gcc dot gnu dot org
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-11-01 20:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2004-11-01 20:42 -------
Created an attachment (id=7454)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7454&action=view)
proposed patch
Here's how you'd fix it by adding mutexes. I don't know if all of these are
necessary, because I haven't bothered to reproduce it. If you can test this
patch and see if it fixes your fail I'd appreciate it.
Is there a way to get this to fail without ACE?
-benjamin
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (7 preceding siblings ...)
2004-11-01 20:42 ` bkoz at gcc dot gnu dot org
@ 2004-11-02 5:48 ` bkoz at gcc dot gnu dot org
2004-11-02 23:45 ` bkoz at gcc dot gnu dot org
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-11-02 5:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2004-11-02 05:48 -------
Mine.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |bkoz at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (8 preceding siblings ...)
2004-11-02 5:48 ` bkoz at gcc dot gnu dot org
@ 2004-11-02 23:45 ` bkoz at gcc dot gnu dot org
2004-11-03 12:24 ` [Bug libstdc++/17664] [3.4 only] " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-11-02 23:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2004-11-02 23:45 -------
Compiled like so, after setting LD_LIBRARY_PATH to ACE libs:
g++ -g -O2 -pthread -I$bld/H-x86-ACE/include -L$bld/H-x86-ACE/lib -lACE 17664.cc
As suspected, only the safe_iterator bits in the original patch needed to go in.
However, this did fix this stuff up. I'm checking into head, will fix for 3.4.4.
-benjamin
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] [3.4 only] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (9 preceding siblings ...)
2004-11-02 23:45 ` bkoz at gcc dot gnu dot org
@ 2004-11-03 12:24 ` pinskia at gcc dot gnu dot org
2004-11-08 20:47 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-03 12:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-03 12:24 -------
Fixed on the mainline, queued for 3.4.4.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.0.0
Last reconfirmed|0000-00-00 00:00:00 |2004-11-03 12:24:25
date| |
Summary|Crash in std::map when using|[3.4 only] Crash in std::map
|_GLIBCXX_DEBUG with |when using _GLIBCXX_DEBUG
|multithreading |with multithreading
Target Milestone|--- |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] [3.4 only] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (10 preceding siblings ...)
2004-11-03 12:24 ` [Bug libstdc++/17664] [3.4 only] " pinskia at gcc dot gnu dot org
@ 2004-11-08 20:47 ` cvs-commit at gcc dot gnu dot org
2004-11-08 20:50 ` bkoz at gcc dot gnu dot org
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-08 20:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-11-08 20:47 -------
Subject: Bug 17664
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: bkoz@gcc.gnu.org 2004-11-08 20:47:25
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/src: debug.cc
Log message:
2004-11-08 Benjamin Kosnik <bkoz@redhat.com>
Doug Gregor <dgregor@cs.indiana.edu>
PR libstdc++/17664
* src/debug.cc: Just use one mutex.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2756&r2=1.2757
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/debug.cc.diff?cvsroot=gcc&r1=1.9&r2=1.10
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] [3.4 only] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (11 preceding siblings ...)
2004-11-08 20:47 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-08 20:50 ` bkoz at gcc dot gnu dot org
2004-11-08 20:50 ` bkoz at gcc dot gnu dot org
2004-11-08 21:11 ` cvs-commit at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-11-08 20:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2004-11-08 20:50 -------
Fixed mainline, 3.4.branch
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] [3.4 only] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (12 preceding siblings ...)
2004-11-08 20:50 ` bkoz at gcc dot gnu dot org
@ 2004-11-08 20:50 ` bkoz at gcc dot gnu dot org
2004-11-08 21:11 ` cvs-commit at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-11-08 20:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2004-11-08 20:50 -------
Fixed
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug libstdc++/17664] [3.4 only] Crash in std::map when using _GLIBCXX_DEBUG with multithreading
2004-09-24 22:05 [Bug libstdc++/17664] New: Crash in std::map when using _GLIBCXX_DEBUG with multithreading lothar at xcerla dot com
` (13 preceding siblings ...)
2004-11-08 20:50 ` bkoz at gcc dot gnu dot org
@ 2004-11-08 21:11 ` cvs-commit at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-08 21:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-11-08 21:10 -------
Subject: Bug 17664
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: bkoz@gcc.gnu.org 2004-11-08 21:10:17
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/src: debug.cc
Log message:
2004-11-08 Benjamin Kosnik <bkoz@redhat.com>
Doug Gregor <dgregor@cs.indiana.edu>
PR libstdc++/17664
* src/debug.cc : Just use one mutex.
2004-11-08 Benjamin Kosnik <bkoz@redhat.com>
Lothar Werzinger <lothar@xcerla.com>
PR libstdc++/17664
* src/debug.cc: Include concurrence, use mutexes.
(_Safe_iterator_base::_M_attach): Here.
(_Safe_iterator_base::_M_detach): Here.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.197&r2=1.2224.2.198
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/debug.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3.10.4&r2=1.3.10.5
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17664
^ permalink raw reply [flat|nested] 16+ messages in thread