public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [BUG] gdb crash when "python import gtk"
@ 2012-07-19  5:26 Hui Zhu
  2012-07-19  7:16 ` Hui Zhu
  0 siblings, 1 reply; 11+ messages in thread
From: Hui Zhu @ 2012-07-19  5:26 UTC (permalink / raw)
  To: gdb

GNU gdb (GDB) 7.5.50.20120719-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) python import gtk
memory clobbered before allocated block
Aborted (core dumped)

But in 7.4.1 is OK.
./gdb
GNU gdb (GDB) 7.4.1.20120718-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Setting up the environment for debugging gdb.
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n])
[answered N; input not from terminal]
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n])
[answered N; input not from terminal]
.gdbinit:8: Error in sourced command file:
Argument required (one or more breakpoint numbers).
(gdb) python import gtk


I will spend some time on it but I am not sure I can fix it.
I think this issue is dangerous because we don't know how much other
python modules are affected by this issue.  Wish it can be fixed
before 7.5 release.

Thanks,
Hui

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] gdb crash when "python import gtk"
  2012-07-19  5:26 [BUG] gdb crash when "python import gtk" Hui Zhu
@ 2012-07-19  7:16 ` Hui Zhu
  2012-07-19  7:21   ` Phil Muldoon
  2012-07-19  7:40   ` Jan Kratochvil
  0 siblings, 2 replies; 11+ messages in thread
From: Hui Zhu @ 2012-07-19  7:16 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

Hi Jan,

Without http://sourceware.org/git/?p=gdb.git;a=commit;h=d43ca3bfc165c72be20288233d20d61ec107a2de
that you committed.

This issue doesn't occur.

Thanks,
Hui

On Thu, Jul 19, 2012 at 1:25 PM, Hui Zhu <teawater@gmail.com> wrote:
> GNU gdb (GDB) 7.5.50.20120719-cvs
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-unknown-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> (gdb) python import gtk
> memory clobbered before allocated block
> Aborted (core dumped)
>
> But in 7.4.1 is OK.
> ./gdb
> GNU gdb (GDB) 7.4.1.20120718-cvs
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-unknown-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Setting up the environment for debugging gdb.
> No symbol table is loaded.  Use the "file" command.
> Make breakpoint pending on future shared library load? (y or [n])
> [answered N; input not from terminal]
> No symbol table is loaded.  Use the "file" command.
> Make breakpoint pending on future shared library load? (y or [n])
> [answered N; input not from terminal]
> .gdbinit:8: Error in sourced command file:
> Argument required (one or more breakpoint numbers).
> (gdb) python import gtk
>
>
> I will spend some time on it but I am not sure I can fix it.
> I think this issue is dangerous because we don't know how much other
> python modules are affected by this issue.  Wish it can be fixed
> before 7.5 release.
>
> Thanks,
> Hui

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] gdb crash when "python import gtk"
  2012-07-19  7:16 ` Hui Zhu
@ 2012-07-19  7:21   ` Phil Muldoon
  2012-07-19  7:40   ` Jan Kratochvil
  1 sibling, 0 replies; 11+ messages in thread
From: Phil Muldoon @ 2012-07-19  7:21 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Jan Kratochvil, gdb

On 07/19/2012 08:15 AM, Hui Zhu wrote:
> Hi Jan,
> 
> Without http://sourceware.org/git/?p=gdb.git;a=commit;h=d43ca3bfc165c72be20288233d20d61ec107a2de
> that you committed.
> 
> This issue doesn't occur.

>>
>> But in 7.4.1 is OK.
>> ./gdb
>> (gdb) python import gtk

I don't see this building from cvs head.  Can you post a backtrace of the inferior GDB crashing?

Cheers,

Phil

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] gdb crash when "python import gtk"
  2012-07-19  7:16 ` Hui Zhu
  2012-07-19  7:21   ` Phil Muldoon
@ 2012-07-19  7:40   ` Jan Kratochvil
  2012-07-19  7:54     ` Hui Zhu
       [not found]     ` <A681786A-58A1-41E6-8410-8EBD8330E6BE@cs.umd.edu>
  1 sibling, 2 replies; 11+ messages in thread
From: Jan Kratochvil @ 2012-07-19  7:40 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb

Hi Hui,

On Thu, 19 Jul 2012 09:15:57 +0200, Hui Zhu wrote:
> Without http://sourceware.org/git/?p=gdb.git;a=commit;h=d43ca3bfc165c72be20288233d20d61ec107a2de
> that you committed.

the problem is apparently the new -lmcheck lightweight memory corruption
testing.


> On Thu, Jul 19, 2012 at 1:25 PM, Hui Zhu <teawater@gmail.com> wrote:
> > GNU gdb (GDB) 7.5.50.20120719-cvs
[...]
> > (gdb) python import gtk
> > memory clobbered before allocated block
> > Aborted (core dumped)

So the bug is in some gtk code, either the Python binding or the C gtk
implementation itself.


> > But in 7.4.1 is OK.

It did not use -lmcheck so the memory corruption still was there but it was
not shown.


> > I think this issue is dangerous because we don't know how much other
> > python modules are affected by this issue.  Wish it can be fixed
> > before 7.5 release.

It will not affect the 7.5 release and neither the 7.5 pre-releases:
	[commit/branch] development mode no longer enabled by default
	http://sourceware.org/ml/gdb-patches/2012-07/msg00251.html

On Fedora 17 x86_64 I do not see any problem even with more thorough memory
testing via valgrind:
	valgrind ./gdb -ex 'python import gtk' -ex q
	pygtk2-2.24.0-4.fc17.x86_64
	gtk2-2.24.10-2.fc17.x86_64

So you should file it as pygtk2 bug for the distro you use.


Thanks,
Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] gdb crash when "python import gtk"
  2012-07-19  7:40   ` Jan Kratochvil
@ 2012-07-19  7:54     ` Hui Zhu
       [not found]     ` <A681786A-58A1-41E6-8410-8EBD8330E6BE@cs.umd.edu>
  1 sibling, 0 replies; 11+ messages in thread
From: Hui Zhu @ 2012-07-19  7:54 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

On Thu, Jul 19, 2012 at 3:39 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> Hi Hui,
>
> On Thu, 19 Jul 2012 09:15:57 +0200, Hui Zhu wrote:
>> Without http://sourceware.org/git/?p=gdb.git;a=commit;h=d43ca3bfc165c72be20288233d20d61ec107a2de
>> that you committed.
>
> the problem is apparently the new -lmcheck lightweight memory corruption
> testing.
>
>
>> On Thu, Jul 19, 2012 at 1:25 PM, Hui Zhu <teawater@gmail.com> wrote:
>> > GNU gdb (GDB) 7.5.50.20120719-cvs
> [...]
>> > (gdb) python import gtk
>> > memory clobbered before allocated block
>> > Aborted (core dumped)
>
> So the bug is in some gtk code, either the Python binding or the C gtk
> implementation itself.
>
>
>> > But in 7.4.1 is OK.
>
> It did not use -lmcheck so the memory corruption still was there but it was
> not shown.
>
>
>> > I think this issue is dangerous because we don't know how much other
>> > python modules are affected by this issue.  Wish it can be fixed
>> > before 7.5 release.
>
> It will not affect the 7.5 release and neither the 7.5 pre-releases:
>         [commit/branch] development mode no longer enabled by default
>         http://sourceware.org/ml/gdb-patches/2012-07/msg00251.html
>
> On Fedora 17 x86_64 I do not see any problem even with more thorough memory
> testing via valgrind:
>         valgrind ./gdb -ex 'python import gtk' -ex q
>         pygtk2-2.24.0-4.fc17.x86_64
>         gtk2-2.24.10-2.fc17.x86_64
>
> So you should file it as pygtk2 bug for the distro you use.
>
>
> Thanks,
> Jan

OK.  Thanks for your help.

Report this issue to
https://bugs.launchpad.net/ubuntu/+source/pygtk/+bug/1026487

Thanks,
Hui

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk")
       [not found]     ` <A681786A-58A1-41E6-8410-8EBD8330E6BE@cs.umd.edu>
@ 2012-08-30 16:05       ` Jan Kratochvil
  2012-08-30 16:07         ` Jan Kratochvil
  2012-08-30 16:09         ` Khoo Yit Phang
  0 siblings, 2 replies; 11+ messages in thread
From: Jan Kratochvil @ 2012-08-30 16:05 UTC (permalink / raw)
  To: Khoo Yit Phang; +Cc: Hui Zhu, gdb

Hi,

On Thu, 30 Aug 2012 18:00:46 +0200, Khoo Yit Phang wrote:
> I ran into a similar issue as below and tracked it down: the "memory
> clobbered before allocated block" (and other related messages) because
> -lmcheck is not thread safe, and triggers spuriously when threads are used
> in Python (e.g., the "gtk" module).

this needs some references to glibc/gtk/python maintainers statements etc.

-lmcheck is AFAIK thread safe in glibc itself.

It seems to me rather that python and/or gtk may have some bugs exposed by
-lmcheck.  Could you provide a reproducer (with proper versions of all
components and OS) of the problematic behavior?


Thanks,
Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk")
  2012-08-30 16:05       ` Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk") Jan Kratochvil
@ 2012-08-30 16:07         ` Jan Kratochvil
  2012-08-30 16:09         ` Khoo Yit Phang
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Kratochvil @ 2012-08-30 16:07 UTC (permalink / raw)
  To: Khoo Yit Phang; +Cc: Hui Zhu, gdb

On Thu, 30 Aug 2012 18:04:38 +0200, Jan Kratochvil wrote:
> Could you provide a reproducer (with proper versions of all
> components and OS) of the problematic behavior?

I see now you refer to
	https://bugs.launchpad.net/ubuntu/+source/pygtk/+bug/1026487

This still looks so far as Ubuntu specific issue not reproducible on other
distros.  Could you properly debug it for example with valgrind?


Thanks,
Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk")
  2012-08-30 16:05       ` Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk") Jan Kratochvil
  2012-08-30 16:07         ` Jan Kratochvil
@ 2012-08-30 16:09         ` Khoo Yit Phang
  2012-08-30 16:11           ` Khoo Yit Phang
  1 sibling, 1 reply; 11+ messages in thread
From: Khoo Yit Phang @ 2012-08-30 16:09 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Khoo Yit Phang, Hui Zhu, gdb

Hi,

On Aug 30, 2012, at 12:04 PM, Jan Kratochvil wrote:

> Hi,
> 
> On Thu, 30 Aug 2012 18:00:46 +0200, Khoo Yit Phang wrote:
>> I ran into a similar issue as below and tracked it down: the "memory
>> clobbered before allocated block" (and other related messages) because
>> -lmcheck is not thread safe, and triggers spuriously when threads are used
>> in Python (e.g., the "gtk" module).
> 
> this needs some references to glibc/gtk/python maintainers statements etc.
> 
> -lmcheck is AFAIK thread safe in glibc itself.

-lmcheck is definitely not thread safe, at least as of glibc 2.13 (Ubuntu 11.04). See the first answer of http://stackoverflow.com/questions/314931/glibcs-lmcheck-option-and-multithreading.

Yit
August 30, 2012

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk")
  2012-08-30 16:09         ` Khoo Yit Phang
@ 2012-08-30 16:11           ` Khoo Yit Phang
  2012-08-30 16:41             ` Khoo Yit Phang
  2012-09-06 19:30             ` Tom Tromey
  0 siblings, 2 replies; 11+ messages in thread
From: Khoo Yit Phang @ 2012-08-30 16:11 UTC (permalink / raw)
  To: Khoo Yit Phang; +Cc: Jan Kratochvil, Hui Zhu, gdb

Hi,

Here's the corresponding bug report for glibc stating that it is by design: http://sourceware.org/bugzilla/show_bug.cgi?id=9939

Yit
August 30, 2012

On Aug 30, 2012, at 12:08 PM, Khoo Yit Phang wrote:

> Hi,
> 
> On Aug 30, 2012, at 12:04 PM, Jan Kratochvil wrote:
> 
>> Hi,
>> 
>> On Thu, 30 Aug 2012 18:00:46 +0200, Khoo Yit Phang wrote:
>>> I ran into a similar issue as below and tracked it down: the "memory
>>> clobbered before allocated block" (and other related messages) because
>>> -lmcheck is not thread safe, and triggers spuriously when threads are used
>>> in Python (e.g., the "gtk" module).
>> 
>> this needs some references to glibc/gtk/python maintainers statements etc.
>> 
>> -lmcheck is AFAIK thread safe in glibc itself.
> 
> -lmcheck is definitely not thread safe, at least as of glibc 2.13 (Ubuntu 11.04). See the first answer of http://stackoverflow.com/questions/314931/glibcs-lmcheck-option-and-multithreading.
> 
> Yit
> August 30, 2012

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk")
  2012-08-30 16:11           ` Khoo Yit Phang
@ 2012-08-30 16:41             ` Khoo Yit Phang
  2012-09-06 19:30             ` Tom Tromey
  1 sibling, 0 replies; 11+ messages in thread
From: Khoo Yit Phang @ 2012-08-30 16:41 UTC (permalink / raw)
  To: Khoo Yit Phang; +Cc: Jan Kratochvil, Hui Zhu, gdb

Hi,

Here's a test case that shows the problem, semi-reliably (it is a concurrency bug):

 (gdb) python
 >from threading import Thread
 >def blah():
 >  while True:
 >    a = [ {}, {}, {}, {}, 1, 2, "abc" ]
 >
 >t = Thread(None, blah)
 >t.start()
 >
 >for i in range(100000):
 >  gdb.execute("break foo", to_string=True)
 >end
 (gdb) *** glibc detected *** /home/khooyp/Projects/Research/gdb-1/build.yubuntu/gdb/gdb: munmap_chunk(): invalid pointer: 0x09b05d10 ***
...

It is unrelated to pygtk.

Yit
August 30, 2012

On Aug 30, 2012, at 12:11 PM, Khoo Yit Phang wrote:

> Hi,
> 
> Here's the corresponding bug report for glibc stating that it is by design: http://sourceware.org/bugzilla/show_bug.cgi?id=9939
> 
> Yit
> August 30, 2012
> 
> On Aug 30, 2012, at 12:08 PM, Khoo Yit Phang wrote:
> 
>> Hi,
>> 
>> On Aug 30, 2012, at 12:04 PM, Jan Kratochvil wrote:
>> 
>>> Hi,
>>> 
>>> On Thu, 30 Aug 2012 18:00:46 +0200, Khoo Yit Phang wrote:
>>>> I ran into a similar issue as below and tracked it down: the "memory
>>>> clobbered before allocated block" (and other related messages) because
>>>> -lmcheck is not thread safe, and triggers spuriously when threads are used
>>>> in Python (e.g., the "gtk" module).
>>> 
>>> this needs some references to glibc/gtk/python maintainers statements etc.
>>> 
>>> -lmcheck is AFAIK thread safe in glibc itself.
>> 
>> -lmcheck is definitely not thread safe, at least as of glibc 2.13 (Ubuntu 11.04). See the first answer of http://stackoverflow.com/questions/314931/glibcs-lmcheck-option-and-multithreading.
>> 
>> Yit
>> August 30, 2012

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk")
  2012-08-30 16:11           ` Khoo Yit Phang
  2012-08-30 16:41             ` Khoo Yit Phang
@ 2012-09-06 19:30             ` Tom Tromey
  1 sibling, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2012-09-06 19:30 UTC (permalink / raw)
  To: Khoo Yit Phang; +Cc: Jan Kratochvil, Hui Zhu, gdb

>>>>> "Yit" == Khoo Yit Phang <khooyp@cs.umd.edu> writes:

Yit> Here's the corresponding bug report for glibc stating that it is by
Yit> design: http://sourceware.org/bugzilla/show_bug.cgi?id=9939

I asked the local glibc hackers to see if they can fix it.
It seems to me that, while the existing malloc hooks are inherently
broken for multi-threading in the "wrapper" case, there is no deep
reason that mcheck has to use these hooks.

Tom

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-09-06 19:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-19  5:26 [BUG] gdb crash when "python import gtk" Hui Zhu
2012-07-19  7:16 ` Hui Zhu
2012-07-19  7:21   ` Phil Muldoon
2012-07-19  7:40   ` Jan Kratochvil
2012-07-19  7:54     ` Hui Zhu
     [not found]     ` <A681786A-58A1-41E6-8410-8EBD8330E6BE@cs.umd.edu>
2012-08-30 16:05       ` Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk") Jan Kratochvil
2012-08-30 16:07         ` Jan Kratochvil
2012-08-30 16:09         ` Khoo Yit Phang
2012-08-30 16:11           ` Khoo Yit Phang
2012-08-30 16:41             ` Khoo Yit Phang
2012-09-06 19:30             ` Tom Tromey

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).