Gunicorn 19.4.2 not working, downgraded to 19.4.1 #1171

Closed
raratiru opened this Issue Dec 29, 2015 · 10 comments

Projects

None yet

4 participants

@raratiru

On a Fedora 22 environment with virtualenvs, after upgrading Gunicorn, nginx would not serve the requested web page.

The solution was to downgrade.

My project is called 'air' and the gunicorn logs reported that:

ImportError: No module named 'air'

Then, I tried to manually start gunicorn which resulted in the following error:

AttributeError: 'os.stat_result' object has no attribute 'S_IWUSR'

More specifically:

$ /home/carmen/.virtualenvs/airp/bin/gunicorn air.wsgi:application -c /home/carmen/00_server/settings/gunicorn_air.conf.py
Traceback (most recent call last):
  File "/home/carmen/.virtualenvs/airp/bin/gunicorn", line 11, in <module>
    sys.exit(run())
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/app/base.py", line 192, in run
    super(Application, self).run()
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/arbiter.py", line 61, in __init__
    self.setup(app)
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/arbiter.py", line 94, in setup
    self.log = self.cfg.logger_class(app.cfg)
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/glogging.py", line 178, in __init__
    self.setup(cfg)
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/glogging.py", line 187, in setup
    logging.Formatter(self.error_fmt, self.datefmt))
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/glogging.py", line 342, in _set_handler
    self.cfg.group):
  File "/home/carmen/.virtualenvs/airp/lib/python3.4/site-packages/gunicorn/util.py", line 170, in is_writable
    return st.st_mode & st.S_IWUSR != 0
AttributeError: 'os.stat_result' object has no attribute 'S_IWUSR'
@benoitc
Owner
benoitc commented Dec 29, 2015

can you provides more details? Is SELINUX enabled? What is your command line?

@benoitc
Owner
benoitc commented Dec 29, 2015

also python version

@raratiru

Yes Selinux is enabled. Up to now, I have arranged it so the system is working correctly. I did not have any alert while this issue was present.

The python version I am using is 3.4.

The command line is the following:

$ /home/carmen/.virtualenvs/airp/bin/gunicorn air.wsgi:application -c /home/carmen/00_server/settings/gunicorn_air.conf.py

I also tested it one more time:

Upgrading to 19.4.2 the issue appears. Donwgrading to 19.4.1 everything works great.

@jhg-tgu
jhg-tgu commented Dec 29, 2015

Same error with Python 3.4.3 only with 19.4.2 with 19.4.1 work.

Traceback (most recent call last):
  File "/opt/env/bin/gunicorn", line 11, in <module>
    sys.exit(run())
  File "/opt/env/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/opt/env/lib/python3.4/site-packages/gunicorn/app/base.py", line 192, in run
    super(Application, self).run()
  File "/opt/env/lib/python3.4/site-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/opt/env/lib/python3.4/site-packages/gunicorn/arbiter.py", line 61, in __init__
    self.setup(app)
  File "/opt/env/lib/python3.4/site-packages/gunicorn/arbiter.py", line 94, in setup
    self.log = self.cfg.logger_class(app.cfg)
  File "/opt/env/lib/python3.4/site-packages/gunicorn/glogging.py", line 178, in __init__
    self.setup(cfg)
  File "/opt/env/lib/python3.4/site-packages/gunicorn/glogging.py", line 187, in setup
    logging.Formatter(self.error_fmt, self.datefmt))
  File "/opt/env/lib/python3.4/site-packages/gunicorn/glogging.py", line 342, in _set_handler
    self.cfg.group):
  File "/opt/env/lib/python3.4/site-packages/gunicorn/util.py", line 170, in is_writable
    return st.st_mode & st.S_IWUSR != 0
AttributeError: 'os.stat_result' object has no attribute 'S_IWUSR'

Only when use option --log-file without this option work.

@jesper
jesper commented Dec 29, 2015

Same issue here. 19.4.1 works, 19.4.2 doesn't. (same S_IWUSR stacktrace). Using Python 2.7.10.

@benoitc benoitc added a commit that referenced this issue Dec 29, 2015
@benoitc don't check if a file is writable using os.stat
Some systems edisable like SELINUX disable some flags so ignore the possible
error while chowning a log file. The error will be raised later anyway.

fix #1171
6439c3b
@benoitc
Owner
benoitc commented Dec 29, 2015

The error is due to the change introduced in c805bd2 . Above fix should work. will post it asap.

@benoitc
Owner
benoitc commented Dec 29, 2015

@jesper also on fedora? Any extension that could block the permissions?

@jhg-tgu
jhg-tgu commented Dec 29, 2015

Thanks @benoitc

@benoitc benoitc closed this in #1172 Dec 29, 2015
@benoitc
Owner
benoitc commented Dec 29, 2015

19.4.3 has been released. Sorry for the inconvenience and thanks for the feedback all!

@raratiru

Thank you indeed, your efforts are priceless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment