code-google-com / pyv8

Automatically exported from code.google.com/p/pyv8
0 stars 0 forks source link

Strange error after updating to -r527 #198

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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