marylinh / pyv8

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

PyV8 - Django #59

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am using PyV8 (the pre build version) in a Windows Django project

I have this function in Django

def action_javascript(value):
    ctxt = PyV8.JSContext()
    ctxt.enter()
    return ctxt.eval(value) 

When I run this with the django runserver it works fine!!! However when I run 
it on a production server (cherryPY) it crashes after I call it a number of 
times. Any Ideas?

So I tried to build the latest from source however I am getting 28 errors with 
the latest version of V8. What revision number should I use for V8?

Tom

Original issue reported on code.google.com by tturner%...@gtempaccount.com on 20 Sep 2010 at 8:12

GoogleCodeExporter commented 9 years ago
Could you provide a simple demo to reproduce the issue?

I'm not familiar with cherryPY, but I guess it may caused by its thread model. 
As you know, v8 doesn't support multi-threads, it means you should protect its 
engine with lock, or simular a preemption thread by manual. PyV8 provide some 
supports about those, but I think it may not be well test, because most of my 
scenes are single thread.

So, if you haven't too many time, just protect your pyv8 related code with 
lock, it will be easy for most scene, or if you have interests, we could cowork 
to make its multi-threads more stable.

You could just check out the latest v8 code with latest pyv8 from SVN trunk.

Original comment by flier...@gmail.com on 22 Sep 2010 at 1:53

GoogleCodeExporter commented 9 years ago
I guess cherryPy use a different threading model, we should use lock/unlock to 
ensure the pyv8 engine doesn't be used in two threads at same time.

Original comment by flier...@gmail.com on 6 Apr 2011 at 4:54