eukreign / python-v8

Apache License 2.0
12 stars 6 forks source link

Strange error after updating to -r527 #22

Open eukreign opened 10 years ago

eukreign commented 10 years ago

From angelo.d...@gmail.com on August 19, 2013 13:57:16

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: http://code.google.com/p/pyv8/issues/detail?id=198

eukreign commented 10 years ago

From flier...@gmail.com on August 19, 2013 20:26:43

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

Status: Accepted
Labels: OpSys-All

eukreign commented 10 years ago

From angelo.d...@gmail.com on August 20, 2013 03:17:33

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).

eukreign commented 10 years ago

From angelo.d...@gmail.com on September 03, 2013 00:19:01

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.

eukreign commented 10 years ago

From angelo.d...@gmail.com on September 13, 2013 01:34:07

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.

eukreign commented 10 years ago

From 0xC...@gmail.com on September 30, 2013 02:59:19

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.

eukreign commented 10 years ago

From jmalo...@gmail.com on November 17, 2013 20:54:23

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

eukreign commented 10 years ago

From jmalo...@gmail.com on November 17, 2013 22:23:53

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

eukreign commented 10 years ago

From jmalo...@gmail.com on November 17, 2013 22:36:51

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.

eukreign commented 10 years ago

From jmalo...@gmail.com on November 18, 2013 16:52:11

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

eukreign commented 10 years ago

From angelo.d...@gmail.com on March 05, 2014 04:28:44

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.