After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 575781 - pyg_notify_free needs to ensure it has GIL before calling Py_XDECREF
pyg_notify_free needs to ensure it has GIL before calling Py_XDECREF
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gio
Git master
Other Linux
: Normal major
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
: 578637 581928 583678 583745 583827 583950 584549 584603 584798 585316 586039 586042 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-03-18 01:52 UTC by Jonathan Matthew
Modified: 2009-06-16 22:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
obvious patch (494 bytes, patch)
2009-03-18 01:54 UTC, Jonathan Matthew
committed Details | Review

Description Jonathan Matthew 2009-03-18 01:52:39 UTC
I'm getting a crash with this stack trace in rhythmbox:

Program received signal SIGSEGV, Segmentation fault.

Thread 3059951440 (LWP 23133)

  • #0 PyErr_Fetch
    at Python/errors.c line 219
  • #1 instance_dealloc
    at Objects/classobject.c line 626
  • #2 tupledealloc
    at Objects/tupleobject.c line 169
  • #3 dict_dealloc
    at Objects/dictobject.c line 851
  • #4 subtype_dealloc
    at Objects/typeobject.c line 697
  • #5 instancemethod_dealloc
    at Objects/classobject.c line 2311
  • #6 pygio_notify_free
    at gio.override line 148
  • #7 IA__g_datalist_clear
    at gdataset.c line 120
  • #8 g_object_finalize
    at gobject.c line 747
  • #9 g_simple_async_result_finalize
    at gsimpleasyncresult.c line 163
  • #10 IA__g_object_unref
    at gobject.c line 2421
  • #11 complete_in_idle_cb_for_thread
    at gsimpleasyncresult.c line 633
  • #12 g_idle_dispatch
    at gmain.c line 3922
  • #13 IA__g_main_context_dispatch
    at gmain.c line 1814
  • #14 g_main_context_iterate
    at gmain.c line 2448
  • #15 IA__g_main_loop_run
    at gmain.c line 2656
  • #16 IA__gtk_main
    at gtkmain.c line 1205
  • #17 main
    at main.c line 336
$1 = (PyThreadState *) 0x0

which seems to be happening because I'm passing around a sax parser object as the user_data for async read operations.  After the final read operation, it crashes.

Adding another reference to the parser object stops it crashing, I guess because pyg_notify_free doesn't end up destroying it there.  Wrapping the Py_XDECREF calls in pygio_notify_free with pyg_gil_state_ensure/pyg_gil_state_release also stops it crashing.

I can't seem to find a way to trigger the same crash in the gio unit test suite.
Comment 1 Jonathan Matthew 2009-03-18 01:54:29 UTC
Created attachment 130865 [details] [review]
obvious patch
Comment 2 Gustavo Carneiro 2009-03-18 10:53:18 UTC
(In reply to comment #1)
> Created an attachment (id=130865) [edit]
> obvious patch

Looks good.
Comment 3 Jonathan Matthew 2009-04-08 00:43:38 UTC
OK to commit?
Comment 4 Gian Mario Tagliaretti 2009-04-08 07:57:30 UTC
(In reply to comment #3)
> OK to commit?
> 

sure
Comment 5 Jonathan Matthew 2009-04-08 21:55:58 UTC
2009-04-09  Jonathan Matthew  <jonathan@d14n.org>

        Bug 575781 – pyg_notify_free needs to ensure it has GIL before calling
        Py_XDECREF

        * gio/gio.override:  Ensure we're holding the GIL before potentially
        destroying the callback and data.
Comment 6 Jonathan Matthew 2009-04-11 07:16:25 UTC
*** Bug 578637 has been marked as a duplicate of this bug. ***
Comment 7 Paul Pogonyshev 2009-04-12 11:39:12 UTC
Good thing we now have that decref in one place only ;)
Comment 8 Jonathan Matthew 2009-05-09 01:50:11 UTC
*** Bug 581928 has been marked as a duplicate of this bug. ***
Comment 9 Jonathan Matthew 2009-05-23 23:47:25 UTC
*** Bug 583678 has been marked as a duplicate of this bug. ***
Comment 10 Jonathan Matthew 2009-05-24 22:40:53 UTC
*** Bug 583745 has been marked as a duplicate of this bug. ***
Comment 11 Jonathan Matthew 2009-05-25 23:21:14 UTC
*** Bug 583827 has been marked as a duplicate of this bug. ***
Comment 12 Jonathan Matthew 2009-05-28 00:13:25 UTC
*** Bug 583950 has been marked as a duplicate of this bug. ***
Comment 13 Jonathan Matthew 2009-06-02 08:00:45 UTC
*** Bug 584549 has been marked as a duplicate of this bug. ***
Comment 14 Jonathan Matthew 2009-06-03 03:10:38 UTC
*** Bug 584603 has been marked as a duplicate of this bug. ***
Comment 15 Jonathan Matthew 2009-06-04 06:28:42 UTC
*** Bug 584798 has been marked as a duplicate of this bug. ***
Comment 16 Jonathan Matthew 2009-06-10 08:54:47 UTC
*** Bug 585316 has been marked as a duplicate of this bug. ***
Comment 17 Jonathan Matthew 2009-06-16 22:55:59 UTC
*** Bug 586039 has been marked as a duplicate of this bug. ***
Comment 18 Jonathan Matthew 2009-06-16 22:56:14 UTC
*** Bug 586042 has been marked as a duplicate of this bug. ***