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 678908 - Do not call priv_from_js from the GObject tracer
Do not call priv_from_js from the GObject tracer
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2012-06-26 17:36 UTC by Giovanni Campagna
Modified: 2012-07-05 14:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Do not call priv_from_js from the GObject tracer (1.10 KB, patch)
2012-06-26 17:36 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2012-06-26 17:36:01 UTC
priv_from_js calls JS_BeginRequest when it refers to a dynamic JSClass
(such as that used by GObjects), and that causes a deadlock when
called from the GC thread
Comment 1 Giovanni Campagna 2012-06-26 17:36:04 UTC
Created attachment 217312 [details] [review]
Do not call priv_from_js from the GObject tracer
Comment 2 Colin Walters 2012-06-26 20:23:44 UTC
Is this a regression introduced by 06aa616a8c9b6d356aefc95a6b0c1c317b86c46a ?
Comment 3 Giovanni Campagna 2012-07-04 18:05:01 UTC
(Sorry I didn't answer before, I overlooked this)

Yes, this is a regression caused by that. A better fix, as discussed in IRC with Jasper, is to rework the dynamic JS class system to avoid the JS_BeginRequest completely, but that's a tad more invasive.
I don't know if he is working on it.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-07-05 13:18:02 UTC
I am not.
Comment 5 Colin Walters 2012-07-05 13:30:01 UTC
Review of attachment 217312 [details] [review]:

This patch looks OK.  I'm a little unsure about the previous patch; it *sounds* right and I don't see anything wrong in the code, but I still have this feeling that there are corner cases we aren't considering.  Oh well, let's go with it =)
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-07-05 13:35:14 UTC
Review of attachment 217312 [details] [review]:

I talked to the Mozilla guys, though. They pretty much said that the only JSAPI call you can make safely from the GC thread is JS_GetPrivate. JS_BeginRequest/JS_EndRequest are out.
Comment 7 Giovanni Campagna 2012-07-05 14:05:26 UTC
(In reply to comment #4)
> I am not.

Ok. I started some clean up myself in the meanwhile, because I want to make the GC much more aggressive than it is now, in order to reduce memory footprint of gjs apps (125MB and growing for gnome-documents... 150MB, without loading appsystem and icons, for gnome-shell...).
I'll open a new bug when the series is complete.
Comment 8 Giovanni Campagna 2012-07-05 14:12:13 UTC
Attachment 217312 [details] pushed as 54d60c2 - Do not call priv_from_js from the GObject tracer