RoamUniverse / pyv8

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

Strange crash #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Can't determine what's happens, but it happens on PyV8.JSContext(None)!...

Original issue reported on code.google.com by gauss...@gmail.com on 20 Jan 2010 at 12:36

Attachments:

GoogleCodeExporter commented 9 years ago
could you reproduce with some script? it seems v8 crashed when install native 
runtime 
extensions, the parser stack crashed because overflow?

Original comment by flier...@gmail.com on 20 Jan 2010 at 1:01

GoogleCodeExporter commented 9 years ago
I don't know how to reproduce "double importing" 'feature' of django. Tried 
with 
__import__('modulename', {}, {}, ['']) but no success. Looks this issue related 
to it 
because if I add line print '123' to a very beginning of my module - it's 
printed 
twice! So this module perform a twice initialization and twice import PyV8. 
I've just 
workarounded this issue by moving a code to other place. It's functions as 
designed?

Original comment by gauss...@gmail.com on 20 Jan 2010 at 6:48

GoogleCodeExporter commented 9 years ago
I'm not sure, but I guess v8 doesn't support to initialize engine twice, I 
think pyv8 could 
protect it.

Thanks, I will add some code for the scene later

Original comment by flier...@gmail.com on 23 Jan 2010 at 3:19

GoogleCodeExporter commented 9 years ago
I don't know how to reproduce your issue that import same module twice, because 
I think 
every imported module should be added to sys.modules with same name, why they 
could 
be load twice? Could you give me more hint?

Original comment by flier...@gmail.com on 26 Jan 2010 at 4:42

GoogleCodeExporter commented 9 years ago
Just try to run this app with current 1.1.1 or svn version of django with

$ python manage.py runserver

then open http://localhost:8000/ in your web browser.

Original comment by gauss...@gmail.com on 26 Jan 2010 at 7:39

Attachments:

GoogleCodeExporter commented 9 years ago
strange behavior, he says "double importing", is caused by django's 
autoreloader.
whenever modification of imported modules detected, autoreloader reloads all 
files automatically for ease of developing.
if you run django application with integrated httpd typing 'python manage.py 
runserver', autoreloader is enabled by default.

how autoreloader works is following:
1. main process spawns child process by exactly same command line.
2. child process creates new thread to run httpd.
3. child process's main thread compares *.py mtime and *.pyc/*.pyo mtime for 
all imported modules.
4. when child process finds out modified module, he kills himself.
5. main process detects children's death, and respawns it.

duplicated output of "print '123'" is written by different process: parent and 
child.
so python doesn't import same module twice. there shuold be other reason why it 
crashes.

i think problem is using PyV8 with thread.
on my environment(Python 2.6.5, PyV8 r276, v8 r5444, Ubuntu 10.04.1 LTS), 
i got following error running django runserver with attached pyv8crash.tar.bz2:
  Uncaught RangeError: Maximum call stack size exceeded

autoreloader uses thread.start_new_thread to create new httpd thread (where 
'PyV8.JSContext(None)' is evaluated)
and following code reproduces same error:
  import PyV8, thread, time

  def mainfunc():
    PyV8.JSContext(None)

  thread.start_new_thread(mainfunc, ())

  while True:
    time.sleep(1)

anyway, django autoreloader functionality can be disabled by '--noreload' 
option like:
  python manage.py runserver --noreload
it might help you avoid crash.

Original comment by menewe...@gmail.com on 11 Sep 2010 at 10:09

GoogleCodeExporter commented 9 years ago
I got the error when using PyV8 with thread in ubuntu, but it run rightly in 
windows

Original comment by sql...@sina.com on 25 Sep 2010 at 1:20

GoogleCodeExporter commented 9 years ago
Hi sql172, could you reproduce your issue with a simple demo? and which version 
of ubuntu that you are using? thanks

Original comment by flier...@gmail.com on 25 Sep 2010 at 5:26

GoogleCodeExporter commented 9 years ago
I find it did not appear in last version r282. sorry for disturbing you >.<

Original comment by sql...@sina.com on 27 Sep 2010 at 10:50

GoogleCodeExporter commented 9 years ago
import PyV8

def test():
    ctxt = PyV8.JSContext() 
import threading
threading.Thread(target=test).start()

I got 'Uncaught RangeError: Maximum call stack size exceeded
Segmentation fault'
It appear sometime

memory leak while calling in this way
def test():
    ctxt = PyV8.JSContext()
    del ctxt

import time
while True:
    test()
    time.sleep(1)

environment(Python 2.5.5, PyV8 r282, v8 5528, Ubuntu 10.04 LTS)

Original comment by sql...@sina.com on 28 Sep 2010 at 4:13

GoogleCodeExporter commented 9 years ago
Hello all,

I think I am experiencing similar behaviour. Whenever I try to run a very 
simple example the program hangs on line:
ctxt = PyV8.JSContext() 

(Open suse 11.3, Python 2.6)

Original comment by theo...@gmail.com on 19 Nov 2010 at 2:26

GoogleCodeExporter commented 9 years ago
Can't reproduce the issue in the latest SVN trunk code

Original comment by flier...@gmail.com on 15 Jul 2011 at 4:29