Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gunicorn crashed on start with --reload flag #1058

Closed
Schabernack opened this issue Jun 29, 2015 · 13 comments
Closed

gunicorn crashed on start with --reload flag #1058

Schabernack opened this issue Jun 29, 2015 · 13 comments

Comments

@Schabernack
Copy link

Setup: Vagrant, virtualenv, gunicorn 19.3.0:

The following command produces this stack:

gunicorn -c /data/shared/api/gunicorn_config.py -b unix:/tmp/api-dev-gunicorn.sock --log-level INFO --reload wsgi:app

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/vagrant/.pyenv/versions/2.7.6/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/data/virtualenv/default/lib/python2.7/site-packages/gunicorn/reloader.py", line 41, in run
    for filename in self.get_files():
  File "/data/virtualenv/default/lib/python2.7/site-packages/gunicorn/reloader.py", line 30, in get_files
    if hasattr(module, '__file__')
  File "/data/virtualenv/default/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or buffer

If I remove --reload it boots up fine.

@wong2
Copy link
Contributor

wong2 commented Jun 29, 2015

can you paste your config file (gunicorn_config.py) ?

@Schabernack
Copy link
Author

import multiprocessing
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = 'sync'
max_requests = 0
workers = 1

@benoitc
Copy link
Owner

benoitc commented Jun 29, 2015

@Schabernack can you increase the log level to debug? Maybe the trace will be more interesting there. It seems that module.__file__ doesn't return a string there but I don't know why yet. Does one of your modules rewrite it?

@benoitc
Copy link
Owner

benoitc commented Jul 24, 2015

@Schabernack bump.

@Schabernack
Copy link
Author

Sorry Benoit, I fixed this by reinstalling gunicorn and forgot about the ticket. This can be closed.

@benoitc
Copy link
Owner

benoitc commented Jul 24, 2015

@Schabernack np, thanks!

@benoitc benoitc closed this as completed Jul 24, 2015
@jontonsoup
Copy link

I got this issue as well. I'm using docker. Removing --reload was the fix

@EdwardBetts
Copy link
Contributor

I'm seeing this problem.

Python 3.6.4+ (default, Feb 12 2018, 08:25:03) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> [module for module in sys.modules.values() if hasattr(module, "__file__") and module.__file__ is None]
[<module 'keyrings' (namespace)>, <module 'logilab' (namespace)>, <module 'ruamel' (namespace)>]
>>> 

@EdwardBetts
Copy link
Contributor

EdwardBetts commented Feb 19, 2018

I think this change to cpython 3.6 is what is triggering the bug for me: python/cpython@a71397f

@im-n1
Copy link

im-n1 commented Feb 28, 2018

I can confirm this bug. Any chance to be fixed in next release?

@EdwardBetts
Copy link
Contributor

@grafa: Fixed in 8e47986

@im-n1
Copy link

im-n1 commented Feb 28, 2018

Yes I see that but that means installing gunicorn from github/master and not from pypi.

@berkerpeksag
Copy link
Collaborator

We have an open issue to track 19.8 release: #1634 (TL;DR: There is one blocker remaining at the moment.)

mjjbell pushed a commit to mjjbell/gunicorn that referenced this issue Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants