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 19.4.2 not working, downgraded to 19.4.1 #1171

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

Comments

Projects
None yet
4 participants
@raratiru

raratiru commented Dec 29, 2015

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

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Dec 29, 2015

Owner

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

Owner

benoitc commented Dec 29, 2015

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

@benoitc

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Dec 29, 2015

Owner

also python version

Owner

benoitc commented Dec 29, 2015

also python version

@raratiru

This comment has been minimized.

Show comment
Hide comment
@raratiru

raratiru Dec 29, 2015

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.

raratiru commented Dec 29, 2015

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

This comment has been minimized.

Show comment
Hide comment
@jhg-tgu

jhg-tgu 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.

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

This comment has been minimized.

Show comment
Hide comment
@jesper

jesper Dec 29, 2015

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

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 added a commit that referenced this issue Dec 29, 2015

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
@benoitc

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Dec 29, 2015

Owner

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

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

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Dec 29, 2015

Owner

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

Owner

benoitc commented Dec 29, 2015

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

@jhg-tgu

This comment has been minimized.

Show comment
Hide comment
@jhg-tgu

jhg-tgu commented Dec 29, 2015

Thanks @benoitc

@benoitc

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Dec 29, 2015

Owner

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

Owner

benoitc commented Dec 29, 2015

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

@raratiru

This comment has been minimized.

Show comment
Hide comment
@raratiru

raratiru Dec 29, 2015

Thank you indeed, your efforts are priceless.

raratiru commented Dec 29, 2015

Thank you indeed, your efforts are priceless.

fofanov pushed a commit to fofanov/gunicorn that referenced this issue Mar 16, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment