patcpsc/pyv8

Strange error after updating to -r527

Opened this issue · 11 comments

After updating to PyV8 -r527 something broke in Thug and I started getting this 
error (this does not happen in -r526 and previous versions)

File "/home/buffer/thug/src/DOM/Window.py", line 853, in context
    self._context = PyV8.JSContext(self)
TypeError: 'method-wrapper' object has only read-only attributes (assign to 
._context)

Please consider that the code that fails lies within the Window class (which 
subclasses PyV8.JSClass). I took a look at the patch but it does not seem to 
justify this fail. Is it the intended behavior?

Thanks,
Angelo

Original issue reported on code.google.com by angelo.d...@gmail.com on 19 Aug 2013 at 5:57

I checked r527, the major change is store a global object reference in the JS 
context object, it will ensure the global object will be free when JS context 
destroyed.

btw: where is the 'method-wrapper' object? it seems cause the issue

Original comment by flier...@gmail.com on 20 Aug 2013 at 3:26

  • Changed state: Accepted
  • Added labels: OpSys-All
The code which causes the TypeError could be read at

https://github.com/buffer/thug/blob/master/src/DOM/Window.py#L850

Please consider that I'm using V8 -r16223. With PyV8 < -r527 no problems at 
all. The issue appears with -r527 (and successive releases).

Original comment by angelo.d...@gmail.com on 20 Aug 2013 at 10:17

I did a simple test and seems like simply commenting out the line

Py_DECREF(global.ptr());

removes the issue. Hope it could be useful to you.

Original comment by angelo.d...@gmail.com on 3 Sep 2013 at 7:19

After upgrading to V8 -r16670 and PyV8 -r536 I get the following error

"Fatal Python error: Inconsistent interned string state."

I tried again commenting out the line 

Py_DECREF(global.ptr());

and this removes the issue as already pointed out in the previous comment. 


Original comment by angelo.d...@gmail.com on 13 Sep 2013 at 8:34

I was able to reproduce the issue and the fix (using thug to analyze 
facebook.com)
I found the affected line in py_v8/src/Context.cpp.

Original comment by 0xC...@gmail.com on 30 Sep 2013 at 9:59

Flier / Angelo,

"Fatal Python error: Inconsistent interned string state."

The patch looks fine but the above error happens when you call 
JSEngine.collect(). Can you confirm? Do we still need to call 
JSEngine.collect() with the patch in r527?

Thanks

Original comment by jmalo...@gmail.com on 18 Nov 2013 at 4:54

Also, it seems like this only happens when you pass a Global object to 
JSContext()?

Original comment by jmalo...@gmail.com on 18 Nov 2013 at 6:23

To replicate - call JSEngine.collect() in 
https://code.google.com/p/pyv8/source/browse/trunk/PyV8.py#1639 and that should 
produce the error/python segfault.

Original comment by jmalo...@gmail.com on 18 Nov 2013 at 6:36

OK, so disabling SUPPORT_TRACE_LIFECYCLE seems to fix the issue here. 

Original comment by jmalo...@gmail.com on 19 Nov 2013 at 12:52

Flier any update about this issue? Sorry to bother you but I would really like 
to remove the need to patch PyV8 for Thug users. Thanks, Angelo.

Original comment by angelo.d...@gmail.com on 5 Mar 2014 at 12:28

1 year after I suppose this issue it's still relevant because remains opened.
Any news about?

Original comment by rocknrol...@gmail.com on 30 Mar 2015 at 10:58