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 19.9.0 on Python3.8 raises RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode... #2091

Closed
agilezebra opened this issue Aug 15, 2019 · 4 comments · Fixed by #2146

Comments

@agilezebra
Copy link

RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  return io.open(fd, *args, **kwargs)

See https://bugs.python.org/issue32236

Issue is caused by:

gunicorn/workers/workertmp.py", line 33, in __init__
    self._tmp = os.fdopen(fd, 'w+b', 1)
@tilgovi
Copy link
Collaborator

tilgovi commented Aug 18, 2019

I think we could pass 0 because we never write to this file. We only ever call os.fchmod and os.fstat on it.

Would you like to make a PR for this?

phoikoi added a commit to phoikoi/gunicorn that referenced this issue Sep 2, 2019
In Python 3.8, this code emits a RuntimeWarning about line buffering not being supported in binary mode.  In issue benoitc#2091, it is suggested that the fix is to send a 0 instead of a 1 in the `open` call.  So this implements that fix.
@benoitc
Copy link
Owner

benoitc commented Oct 30, 2019

the question also is why suddenly python decided to buffer there also. does anyone knows when the change have been done?

@tilgovi
Copy link
Collaborator

tilgovi commented Oct 30, 2019

Python is not buffering here and never was. The argument of buffering=1 was silently ignored.

The change to emit this warning is new in 3.8: https://bugs.python.org/issue32236

#2146 is ready with the fix and approved.

@benoitc
Copy link
Owner

benoitc commented Oct 30, 2019 via email

david-sinuela-pix4d added a commit to david-sinuela-pix4d/conan that referenced this issue Jan 10, 2020
Python 3.8 started reporting warnings when binary files are opened with
bufsize > 0, see https://bugs.python.org/issue32236 for the change and
benoitc/gunicorn#2091 for a similar issue.

The error message was:

py.warnings: WARNING: /usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
david-sinuela-pix4d added a commit to david-sinuela-pix4d/conan that referenced this issue Jan 10, 2020
Python 3.8 started reporting warnings when binary files are opened with
bufsize > 0, see https://bugs.python.org/issue32236 for the change and
benoitc/gunicorn#2091 for a similar issue.

The error message was:

py.warnings: WARNING: /usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
memsharded pushed a commit to conan-io/conan that referenced this issue Jan 12, 2020
…6333)

Python 3.8 started reporting warnings when binary files are opened with
bufsize > 0, see https://bugs.python.org/issue32236 for the change and
benoitc/gunicorn#2091 for a similar issue.

The error message was:

py.warnings: WARNING: /usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
ciklista pushed a commit to peng-data-minimization/fitness-data-pipeline that referenced this issue Jul 7, 2020
sunu added a commit to alephdata/memorious that referenced this issue Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants