eukreign / python-v8

Apache License 2.0
12 stars 6 forks source link

Segmentation Fault when working with Eventlet #1

Open eukreign opened 10 years ago

eukreign commented 10 years ago

From andrew.r...@gmail.com on May 14, 2010 05:52:02

What steps will reproduce the problem? import PyV8 import eventlet

class Global(PyV8.JSClass): def sleep(self, seconds): eventlet.sleep(seconds)

def run(n): with PyV8.JSContext(Global()) as ctx: return ctx.eval("sleep(2);")

pool = eventlet.GreenPool() for result in pool.imap(run, xrange(5)): print result What is the expected output? What do you see instead? Expected: None None None None None

Instead: Segmentation Fault What version of the product are you using? On what operating system? Eventlet 0.9.7, PyV8 0.9, V8 2.2.9, Python 2.6.2, Ubuntu 9.04 Please provide any additional information below. Strangely enough, if I compile the "sleep(2)", then run it, it works. Only when I eval() something that would cause Eventlet to cooperatively yield does it segfault.

Attachment: segfaultv8.py

Original issue: http://code.google.com/p/pyv8/issues/detail?id=50

eukreign commented 10 years ago

From flier...@gmail.com on May 14, 2010 04:14:08

Status: Accepted

eukreign commented 10 years ago

From andrew.r...@gmail.com on May 14, 2010 04:22:18

Another note I should probably add,

Someone from Freenode #eventlet claims they are able to run the above example just fine on X86_64 with the PyV8 binaries. I'm on i686 and have tried both the PyV8 binaries and compiling from source, but I still get a segfault.

eukreign commented 10 years ago

From flier...@gmail.com on May 16, 2010 09:47:55

I think the root cause is the eventlet base on the greenlet project, which seems use a customized python stack frame for the lightweight coroutine, which may conflict with pyv8's multi-thread support. So, I need more time to study the implement mechanism of greenlet.

Labels: -Type-Defect Type-Enhancement OpSys-All

eukreign commented 10 years ago

From andrew.r...@gmail.com on May 16, 2010 11:59:46

Thanks for looking at it, flier.lu. Are you able to reproduce it?

eukreign commented 10 years ago

From flier...@gmail.com on May 16, 2010 18:47:43

Sure, that's why I believe it is a mechanism issue, pyv8's multi-threading support is not too sophisticated at this time.