rtyler / Spawning

Spawning is a wsgi server which supports multiple processes, multiple threads, green threads, non-blocking HTTP io, and automatic graceful upgrading of code
http://pypi.python.org/pypi/Spawning
MIT License
120 stars 18 forks source link

Spawning may fail to start an application (error occurs while setting processus name) #2

Closed raphaelmonrouzeau closed 14 years ago

raphaelmonrouzeau commented 14 years ago

I'm using "paster serve" to launch a TurboGears application, configured to use spawning and get this exception: 387, in run_controller setproctitle("spawn: controller " + args["argv_str"]) KeyError: 'argv_str'

I'm using this configuration: [server:main] use = egg:Spawning host = 0.0.0.0 port = 8000 num_processes = 12 num_threads = 6

And I launch using this shell script:

!/bin/sh

if [ "$#" != "1" -o ! -f "$1" ]; then
        echo 1>&2 "You must provide a run configuration file"
        exit 255
fi
conf="$(/bin/readlink -f "$1")"
prof="$(basename "$conf" ".ini")"
here="$(/usr/bin/dirname "$(/bin/readlink -f "$0")")"
root="$(/usr/bin/dirname "$here")"
env="$root"/tg2env
. "$env/bin/activate"
"$env/bin/paster" serve --daemon --pid-file "$here/run/$prof.pid" --log-file "$here/log/$prof/all" "$conf" start
rtyler commented 14 years ago

Do you have a simple sample TurboGears application I can use to test and verify a fix for this?

I'm unfortunately not particularly familiar with TurboGears or Paste

raphaelmonrouzeau commented 14 years ago

I'll make one sure. I'll update the thread by then.

stevvooe commented 14 years ago

I have seen this issue as well, so I thought I'd take a moment to show you how to reproduce it.

  1. Setup pylons and activate the virtualenv (get go-pylons.py and run it).

    pylons go-pylons pylons-env source pylons-env/bin/activate

  2. Create a minimal project:

    paster create -t pylons_minimal --no-interactive spawningbug

  3. Cd into the created directory and edit the server:main section of development.ini to look like this:

    [server:main] use = egg:Spawning host = 127.0.0.1 port = 5000

  4. Run the following:

    paster serve development.ini

This is where the crash is.

raphaelmonrouzeau commented 14 years ago

Hey, sorry for late response,

you can find an archive of a turbogears2.1 app there: http://web2.fr.milibris.com:10000/example.tgz

with a relocatable virtualenv there: http://web2.fr.milibris.com:10000/tg2env.tgz

along with the install script (if ever the virtualenv doesn't work): http://web2.fr.milibris.com:10000/tg2-bootstrap.py.gz

you can find relevant information about building all these there: http://www.turbogears.org/2.1/docs/main/DownloadInstall.html

in the example you'll find a development.ini file with 2 [server] sections, one uses the paste's http server, the other is using spawning (which the latest version is in the virtualenv). So you can switch between both.

Last note: you do ./start development.ini, ./stop development.ini or use paster serve development.ini as you wish.

rtyler commented 14 years ago

This should be resolved with SHA: 596efb94854641da33ae150d36a4371768cbb5b8, don't have the time to test it myself locally

raphaelmonrouzeau commented 14 years ago

This works for me, thanks.