From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-07-21 16:55:14
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib | unspecified Summary: attempt to release non-allocated block (Glib/Gtk3) Classification: Bindings Product: gnome-perl Version: unspecified OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: Normal Component: Glib AssignedTo: gtk...@li... ReportedBy: sla...@sa... QAContact: gtk...@li... GNOME version: --- Hi, I don't know if this problem is in Glib bindings or Gtk3 or something else, however the bug is caused directly by a function from Glib, let me try here (also I don't see Gtk3 component under gnome-perl). I make a little app with Perl, using Gtk3 and I get "random" memory corruption. While I was trying to debug it, I found this helpful way: ran it with G_SLICE=debug-blocks and the script aborts with such message: GSlice: MemChecker: attempt to release non-allocated block: 0x<address> size=16 which looks like a bug. Please see a minimal script that can be used to reproduce the issue (100% reproducible on my system). It also contains C code doing similar and the latter works without problem. Thanks! glib (library) 2.32.1 Perl 5.12.4 Glib 1.260 and 1.261 Cairo::Gobject 1.001 Glib::Object::Introspection 0.009 and 0.010 Gtk3 0.006 and 0.007 Glib-1.261/GBoxed.xs - function default_boxed_destroy: I removed the "NOISY" thing to get the additional message here and got: $ G_SLICE=debug-blocks perl test.pl default_boxed_destroy wrapper 0x9467ed0 --- GtkTreeIter 0x946a460 GSlice: MemChecker: attempt to release non-allocated block: 0x946a460 size=16 also, a backstrace with that test.pl: G_SLICE=debug-blocks gdb perl Using host libthread_db library "/lib/libthread_db.so.1". GSlice: MemChecker: attempt to release non-allocated block: 0x889bab8 size=16 Program received signal SIGABRT, Aborted. 0xb7fde430 in __kernel_vsyscall () (gdb) bt #0 0xb7fde430 in __kernel_vsyscall () #1 0xb7cffcef in raise () from /lib/libc.so.6 #2 0xb7d01575 in abort () from /lib/libc.so.6 #3 0xb72e6d8a in g_slice_free1 () from /usr/lib/../lib/libglib-2.0.so.0 #4 0xb6d15cd7 in gtk_tree_iter_free () from /usr/lib/libgtk-3.so.0 #5 0xb73dae81 in _g_type_boxed_free () from /usr/lib/../lib/libgobject-2.0.so.0 #6 0xb73b5134 in g_boxed_free () from /usr/lib/../lib/libgobject-2.0.so.0 #7 0xb741df44 in default_boxed_destroy () from /usr/lib/perl5/vendor_perl/5.12.4/i686-linux-thread-multi/auto/Glib/Glib.so #8 0xb741de18 in XS_Glib__Boxed_DESTROY () from /usr/lib/perl5/vendor_perl/5.12.4/i686-linux-thread-multi/auto/Glib/Glib.so #9 0xb7ef4538 in Perl_pp_entersub () from /usr/lib/libperl.so.5.12 #10 0xb7e895a6 in Perl_call_sv () from /usr/lib/libperl.so.5.12 #11 0xb7efa25d in Perl_sv_clear () from /usr/lib/libperl.so.5.12 #12 0xb7efaa8a in Perl_sv_free2 () from /usr/lib/libperl.so.5.12 #13 0xb7f20e44 in Perl_free_tmps () from /usr/lib/libperl.so.5.12 #14 0xb7eec270 in Perl_pp_unstack () from /usr/lib/libperl.so.5.12 #15 0xb7eeb342 in Perl_runops_standard () from /usr/lib/libperl.so.5.12 #16 0xb7e8f9ae in perl_run () from /usr/lib/libperl.so.5.12 #17 0x08048d12 in main () (gdb) -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |
From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-07-21 16:59:17
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib | unspecified --- Comment #1 from sla...@sa... 2012-07-21 16:59:03 UTC --- Created an attachment (id=219390) --> (https://bugzilla.gnome.org/attachment.cgi?id=219390) test script -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |
From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-08-14 19:10:38
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib | unspecified Torsten Schoenfeld <kaffeetisch> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kaf...@gm... --- Comment #2 from Torsten Schoenfeld <kaf...@gm...> 2012-08-14 19:10:24 UTC --- Nice catch! For some reason, valgrind doesn't see this. The problem is that for caller-allocated out-arguments (like GtkTreeIter), we always use malloc(): <http://git.gnome.org/browse/perl-Glib-Object-Introspection/tree/gperl-i11n-invoke-c.c#n280>. But GtkTreeIter is set up to allocate and free itself via GSlice. I think we will need to change allocate_out_mem() to use g_boxed_copy() on the memory that was allocated with malloc(); afterwards, we can free() the original memory block. This will ensure that the right allocator is used. -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |
From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-08-14 19:24:16
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib | unspecified --- Comment #3 from Torsten Schoenfeld <kaf...@gm...> 2012-08-14 19:24:02 UTC --- Created an attachment (id=221184) View: https://bugzilla.gnome.org/attachment.cgi?id=221184 Review: https://bugzilla.gnome.org/review?bug=680380&attachment=221184 Use the correct allocator for caller-allocated boxed out-args Previously, we simply always used malloc(). But for a boxed type, which has an associated custom free function, this might not be the correct allocator. For example, GtkTreeIter uses GSlice. Make an extra copy of the malloc()-ed block to ensure consistency. -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |
From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-08-14 19:24:55
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib | unspecified Torsten Schoenfeld <kaffeetisch> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 --- Comment #4 from Torsten Schoenfeld <kaf...@gm...> 2012-08-14 19:24:41 UTC --- Can you try the above patch to see if it fixes the issue for you too? -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |
From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-08-16 17:07:00
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib | unspecified --- Comment #5 from sla...@sa... 2012-08-16 17:06:47 UTC --- Great work! I have tried the patch with 0.010 and 0.011 and with both versions the issues are fixed: it doesn't crash with 'debug-blocks', and also memory corruption (with messages like: ***MEMORY-ERROR***: XXXX.pl[XXXX]: GSlice: assertion failed: sinfo->n_allocated > 0) I mentioned above seems to be gone. -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |
From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-08-16 18:48:49
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib | unspecified Torsten Schoenfeld <kaffeetisch> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #6 from Torsten Schoenfeld <kaf...@gm...> 2012-08-16 18:48:37 UTC --- Alright, committed. Thanks for the report. Attachment 221184 pushed as 1e4f04c - Use the correct allocator for caller-allocated boxed out-args -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |
From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-08-16 18:48:50
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib | unspecified Torsten Schoenfeld <kaffeetisch> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #221184|none |committed status| | -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |
From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2012-08-16 18:51:50
|
https://bugzilla.gnome.org/show_bug.cgi?id=680380 gnome-perl | Glib::Object::Introspection | unspecified Torsten Schoenfeld <kaffeetisch> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|Glib |Glib::Object::Introspection -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |