[pypy-dev] pypy sandbox
dalius.dobravolskas at gmail.com
Fri Feb 20 07:30:32 CET 2009
>> I will try to implement WSGI sample similar to Django (as mentioned
> that's cool. Please keep us informed, and feel free to come to #pypy on
> irc.freenode.net if you have any question.
Here is result: http://py.sandbox.lt/
Basically it is the same code as Django example but only written in
WSGI (I will share that later).
Here some of my experiences that I think I should mention:
1. I'm running my code behind Apache mod_wsgi. As you might know
mod_wsgi is very strict WSGI implementation. pypy_interact failed when
was calling isatty function (mod_wsgi.Log does not have this
function). I have fixed that by adding "'isatty in dir(log)". I will
give later exact locations and names if I have confused them.
2. It looks like that PyPySandboxedProc expects --heapsize as first
argument in argument list.
3. Is settimeout actually working? If I run following code (please
don't run it on my server):
x = 1
for y in xrange(1, 1024*1024):
x *= y
Process is not terminated after one second and uses significant part
of my CPU resources. I set timeout in following way:
sandproc = pypy_interact.PyPySandboxedProc(SANDBOX_BIN, ['--heapsize',
str(1024*1024), '-c', code])
I have tried 5 seconds as well. I will analyze the code myself a
little bit but if you have ideas already please share them ;-)
More information about the Pypy-dev