benoitc / gunicorn

gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and sleepy applications.
http://www.gunicorn.org
Other
9.83k stars 1.75k forks source link

Worker fails to boot #351

Closed anyeguyue closed 12 years ago

anyeguyue commented 12 years ago

The application can be start by ./manage.py runserver, but failed to boot using gunicorn.

(mysite)root@ubuntu:/opt/django/projects/mysite# /opt/django/envs/mysite/bin/gunicorn_django -w 1 2012-05-20 16:39:46 [23845] [INFO] Starting gunicorn 0.14.3 2012-05-20 16:39:46 [23845] [INFO] Listening at: http://127.0.0.1:8000 (23845) 2012-05-20 16:39:46 [23845] [INFO] Using worker: sync 2012-05-20 16:39:46 [23848] [INFO] Booting worker with pid: 23848 2012-05-20 16:39:46 [23848] [INFO] Worker exiting (pid: 23848) 2012-05-20 16:39:47 [23845] [INFO] Shutting down: Master 2012-05-20 16:39:47 [23845] [INFO] Reason: Worker failed to boot. (mysite)root@ubuntu:/opt/django/projects/mysite# /opt/django/envs/mysite/bin/gunicorn_django -w 2 2012-05-20 16:39:51 [23849] [INFO] Starting gunicorn 0.14.3 2012-05-20 16:39:51 [23849] [INFO] Listening at: http://127.0.0.1:8000 (23849) 2012-05-20 16:39:51 [23849] [INFO] Using worker: sync 2012-05-20 16:39:51 [23852] [INFO] Booting worker with pid: 23852 2012-05-20 16:39:51 [23853] [INFO] Booting worker with pid: 23853 2012-05-20 16:39:51 [23853] [INFO] Worker exiting (pid: 23853) 2012-05-20 16:39:51 [23852] [INFO] Worker exiting (pid: 23852) Traceback (most recent call last): File "/opt/django/envs/mysite/bin/gunicorn_django", line 9, in load_entry_point('gunicorn==0.14.3', 'console_scripts', 'gunicorn_django')() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn/app/djangoapp.py", line 129, in run DjangoApplication("%prog [OPTIONS] [SETTINGS_PATH]").run() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 129, in run Arbiter(self).run() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 184, in run self.halt(reason=inst.reason, exit_status=inst.exit_status) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 279, in halt self.stop() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 327, in stop self.reap_workers() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 413, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

Any idea? please

benoitc commented 12 years ago

does it launch with manage.py?

anyeguyue commented 12 years ago

The app could boot up if I use ./manage.py run_gunicorn. But not with gunicorn_django -w 2. Any idea? And are they equally the same?

benoitc commented 12 years ago

@anyeguyue where is the settings.py from where your launch the gunicorn_django command? Can you try the latest head of gunicorn by chance ?

anyeguyue commented 12 years ago

Hi,I just downloaded and installed the latest code from github. The settings.py is just under /opt/django/projects/mysite, and that's the location I launch gunicorn_django.

And here are what I got.

(mysite)joey@ubuntu:/opt/django/projects/mysite$ python manage.py run_gunicorn 2012-05-20 18:48:50 [31390] [INFO] Starting gunicorn 0.14.4 2012-05-20 18:48:50 [31390] [INFO] Listening at: http://127.0.0.1:8000 (31390) 2012-05-20 18:48:50 [31390] [INFO] Using worker: sync 2012-05-20 18:48:50 [31393] [INFO] Booting worker with pid: 31393

(mysite)joey@ubuntu:/opt/django/projects/mysite$ /opt/django/envs/mysite/bin/gunicorn_django -w 2 2012-05-20 18:44:08 [31357] [INFO] Starting gunicorn 0.14.4 2012-05-20 18:44:08 [31357] [INFO] Listening at: http://127.0.0.1:8000 (31357) 2012-05-20 18:44:08 [31357] [INFO] Using worker: sync 2012-05-20 18:44:08 [31360] [INFO] Booting worker with pid: 31360 2012-05-20 18:44:08 [31361] [INFO] Booting worker with pid: 31361 2012-05-20 18:44:08 [31360] [INFO] Worker exiting (pid: 31360) 2012-05-20 18:44:08 [31361] [INFO] Worker exiting (pid: 31361) Traceback (most recent call last): File "/opt/django/envs/mysite/bin/gunicorn_django", line 9, in load_entry_point('gunicorn==0.14.4', 'console_scripts', 'gunicorn_django')() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/djangoapp.py", line 132, in run DjangoApplication("%prog [OPTIONS] [SETTINGS_PATH]").run() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/base.py", line 129, in run Arbiter(self).run() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 184, in run self.halt(reason=inst.reason, exit_status=inst.exit_status) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 279, in halt self.stop() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 327, in stop self.reap_workers() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 413, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

benoitc commented 12 years ago

can you aunch the same command with --log-level=debug to get the traceback?

anyeguyue commented 12 years ago

Get "ImportError: No module named account", but the module is there and works fine with runserver and run_gunicorn...

(mysite)root@ubuntu:/opt/django/projects/mysite# /opt/django/envs/mysite/bin/gunicorn_django -w 2 --log-level=debug 2012-05-20 19:38:53 [31436] [INFO] Starting gunicorn 0.14.4 2012-05-20 19:38:53 [31436] [DEBUG] Arbiter booted 2012-05-20 19:38:53 [31436] [INFO] Listening at: http://127.0.0.1:8000 (31436) 2012-05-20 19:38:53 [31436] [INFO] Using worker: sync 2012-05-20 19:38:53 [31439] [INFO] Booting worker with pid: 31439 2012-05-20 19:38:53 [31440] [INFO] Booting worker with pid: 31440 2012-05-20 19:38:53 [31440] [DEBUG] Exception in worker process: Traceback (most recent call last): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 453, in spawn_worker worker.init_process() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/workers/base.py", line 99, in init_process self.wsgi = self.app.wsgi() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/base.py", line 101, in wsgi self.callable = self.load() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/djangoapp.py", line 91, in load return mod.make_wsgi_application() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/django_wsgi.py", line 34, in make_wsgi_application if get_validation_errors(s): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 146, in get_app_errors self._populate() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 61, in _populate self.load_app(app_name, True) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 76, in load_app app_module = import_module(app_name) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module import(name) ImportError: No module named account

2012-05-20 19:38:53 [31440] [INFO] Worker exiting (pid: 31440) 2012-05-20 19:38:53 [31439] [DEBUG] Exception in worker process: Traceback (most recent call last): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 453, in spawn_worker worker.init_process() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/workers/base.py", line 99, in init_process self.wsgi = self.app.wsgi() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/base.py", line 101, in wsgi self.callable = self.load() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/djangoapp.py", line 91, in load return mod.make_wsgi_application() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/django_wsgi.py", line 34, in make_wsgi_application if get_validation_errors(s): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 146, in get_app_errors self._populate() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 61, in _populate self.load_app(app_name, True) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 76, in load_app app_module = import_module(app_name) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module import(name) ImportError: No module named account

2012-05-20 19:38:53 [31439] [INFO] Worker exiting (pid: 31439) Traceback (most recent call last): File "/opt/django/envs/mysite/bin/gunicorn_django", line 9, in load_entry_point('gunicorn==0.14.4', 'console_scripts', 'gunicorn_django')() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/djangoapp.py", line 132, in run DjangoApplication("%prog [OPTIONS] [SETTINGS_PATH]").run() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/base.py", line 129, in run Arbiter(self).run() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 184, in run self.halt(reason=inst.reason, exit_status=inst.exit_status) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 279, in halt self.stop() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 327, in stop self.reap_workers() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 413, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

benoitc commented 12 years ago

ok thanks that helps. Can you eventually paste le the INSTALLED_APPS list in settings. I think i know why anyway.

benoît

On Sunday, May 20, 2012, Joey wrote:

Get "ImportError: No module named account", but the module is there and works fine with runserver and run_gunicorn...

(mysite)root@ubuntu:/opt/django/projects/mysite# /opt/django/envs/mysite/bin/gunicorn_django -w 2 --log-level=debug 2012-05-20 19:38:53 [31436] [INFO] Starting gunicorn 0.14.4 2012-05-20 19:38:53 [31436] [DEBUG] Arbiter booted 2012-05-20 19:38:53 [31436] [INFO] Listening at: http://127.0.0.1:8000(31436) 2012-05-20 19:38:53 [31436] [INFO] Using worker: sync 2012-05-20 19:38:53 [31439] [INFO] Booting worker with pid: 31439 2012-05-20 19:38:53 [31440] [INFO] Booting worker with pid: 31440 2012-05-20 19:38:53 [31440] [DEBUG] Exception in worker process: Traceback (most recent call last): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 453, in spawn_worker worker.init_process() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/workers/base.py", line 99, in init_process self.wsgi = self.app.wsgi() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/base.py", line 101, in wsgi self.callable = self.load() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/djangoapp.py", line 91, in load return mod.make_wsgi_application() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/django_wsgi.py", line 34, in make_wsgi_application if get_validation_errors(s): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 146, in get_app_errors self._populate() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 61, in _populate self.load_app(app_name, True) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 76, in load_app app_module = import_module(app_name) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module import(name) ImportError: No module named account

2012-05-20 19:38:53 [31440] [INFO] Worker exiting (pid: 31440) 2012-05-20 19:38:53 [31439] [DEBUG] Exception in worker process: Traceback (most recent call last): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 453, in spawn_worker worker.init_process() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/workers/base.py", line 99, in init_process self.wsgi = self.app.wsgi() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/base.py", line 101, in wsgi self.callable = self.load() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/djangoapp.py", line 91, in load return mod.make_wsgi_application() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/django_wsgi.py", line 34, in make_wsgi_application if get_validation_errors(s): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 146, in get_app_errors self._populate() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 61, in _populate self.load_app(app_name, True) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/db/models/loading.py", line 76, in load_app app_module = import_module(app_name) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module import(name) ImportError: No module named account

2012-05-20 19:38:53 [31439] [INFO] Worker exiting (pid: 31439) Traceback (most recent call last): File "/opt/django/envs/mysite/bin/gunicorn_django", line 9, in load_entry_point('gunicorn==0.14.4', 'console_scripts', 'gunicorn_django')() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/djangoapp.py", line 132, in run DjangoApplication("%prog [OPTIONS] [SETTINGS_PATH]").run() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/app/base.py", line 129, in run Arbiter(self).run() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 184, in run self.halt(reason=inst.reason, exit_status=inst.exit_status) File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 279, in halt self.stop() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 327, in stop self.reap_workers() File "/opt/django/envs/mysite/local/lib/python2.7/site-packages/gunicorn-0.14.4-py2.7.egg/gunicorn/arbiter.py", line 413, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>


Reply to this email directly or view it on GitHub: https://github.com/benoitc/gunicorn/issues/351#issuecomment-5808345

anyeguyue commented 12 years ago

Sorry I just finished my dinner, here it is... INSTALLED_APPS = [

Django

"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.messages",
"django.contrib.humanize",
"pinax.templatetags",

# theme
"pinax_theme_bootstrap",

# external
"notification", # must be first
"staticfiles",
"compressor",
"debug_toolbar",
"mailer",
"django_openid",
"timezones",
"emailconfirmation",
"announcements",
"pagination",
"idios",
"metron",
"PIL",
"gunicorn",

# Pinax
#"pinax.apps.account",
"pinax.apps.signup_codes",

# project
"about",
"account",
"profiles",
"diary",
"tests",

]

anyeguyue commented 12 years ago

The problem solved. The first line of the gunicorn_django file was "#!/opt/django/env/mysite/bin/python", which is the path of my virtualenviroment python path. The problem solved by replace it as "#!/usr/bin/env python", although they both used the same python interpreter, but there are some PYTHONPATH difference, that's why it was failed before.