Comments (11)
Please test #3033 and let me know how it behaves after it.
from gunicorn.
We got the same issue today in Production and have reduced the version back to 20.1.0 to fix things.
from gunicorn.
Similar thing in my project. Downgraded and it works fine.
ERROR 2023-07-18T20:37:26.355415Z Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 285, in handle keepalive = self.handle_request(req, conn)
DEFAULT 2023-07-18T20:37:26.355419Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DEFAULT 2023-07-18T20:37:26.355424Z File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 357, in handle_request
DEFAULT 2023-07-18T20:37:26.355429Z util.reraise(*sys.exc_info())
DEFAULT 2023-07-18T20:37:26.355434Z File "/usr/local/lib/python3.11/site-packages/gunicorn/util.py", line 641, in reraise
DEFAULT 2023-07-18T20:37:26.355438Z raise value
DEFAULT 2023-07-18T20:37:26.355442Z File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 343, in handle_request
DEFAULT 2023-07-18T20:37:26.355446Z resp.write(item)
DEFAULT 2023-07-18T20:37:26.355450Z File "/usr/local/lib/python3.11/site-packages/gunicorn/http/wsgi.py", line 326, in write
DEFAULT 2023-07-18T20:37:26.355454Z self.send_headers()
DEFAULT 2023-07-18T20:37:26.355459Z File "/usr/local/lib/python3.11/site-packages/gunicorn/http/wsgi.py", line 322, in send_headers
DEFAULT 2023-07-18T20:37:26.355464Z util.write(self.sock, util.to_bytestring(header_str, "latin-1"))
DEFAULT 2023-07-18T20:37:26.355470Z File "/usr/local/lib/python3.11/site-packages/gunicorn/util.py", line 299, in write
DEFAULT 2023-07-18T20:37:26.355473Z sock.sendall(data)
DEFAULT 2023-07-18T20:37:26.355908Z OSError: [Errno 9] Bad file descriptor
DEFAULT 2023-07-18T20:37:26.355914Z [2023-07-18 20:37:26 +0000] [2] [INFO] Worker exiting (pid: 2)
from gunicorn.
Tested using the script below in docker with os
FROM ubuntu:20.04
RUN pip install git+https://github.com/benoitc/gunicorn.git@fix-gthread
Issue is fixed now @benoitc
from gunicorn.
I also tested the fix-gthread branch with the Python 3.11 Debian Docker image, and I did not encounter any errors @benoitc
from gunicorn.
@revanthmahesh how to reproduce it?
from gunicorn.
@SaravEasy I doin't reproduce it. Can you provide more info on how to reproduce it or in which context?
from gunicorn.
@benoitc, let me try to reproduce this issue in a local environment and share more information shortly.
from gunicorn.
Environment Details
Python Version : 3.6
OS architecture: AMD64
Flask: 0.12.1
Werkzeug: 0.12.1
Our API server started throwing the following exceptions intermittently and we noticed this issue and we reduced the version and it worked.
We did not take the open socket or file descriptors at that time or could not find the pattern.
Hope this helps you get started in the right direction. @benoitc
Stack Trace - Error
[2023-07-18 13:59:48 +0000] [18681] [ERROR] Exception in worker process
[2023-07-18 13:59:48 +0000] [18681] [INFO] Worker exiting (pid: 18681)
ValueError: Invalid file descriptor: -1
raise ValueError("Invalid file descriptor: {}".format(fd))
File "/usr/local/lib/python3.6/selectors.py", line 41, in _fileobj_to_fd
return _fileobj_to_fd(fileobj)
File "/usr/local/lib/python3.6/selectors.py", line 224, in _fileobj_lookup
key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
File "/usr/local/lib/python3.6/selectors.py", line 248, in unregister
key = super().unregister(fileobj)
File "/usr/local/lib/python3.6/selectors.py", line 419, in unregister
self.poller.unregister(conn.sock)
File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/gthread.py", line 176, in murder_keepalived
self.murder_keepalived()
File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/gthread.py", line 232, in run
self.run()
File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 142, in init_process
super().init_process()
File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/gthread.py", line 95, in init_process
worker.init_process()
File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
Traceback (most recent call last):
[2023-07-18 13:59:49 +0000] [16] [ERROR] Worker (pid:18681) exited with code 255.
[2023-07-18 13:59:49 +0000] [16] [ERROR] Worker (pid:18681) exited with code 255
from gunicorn.
Thank you @benoitc -- this also affected us.
from gunicorn.
change applied in master. Thaks for the feedback!
from gunicorn.
Related Issues (20)
- Improper parsing of chunk lengths HOT 2
- Backlog size monitoring HOT 2
- Error instead of warning in logs when sending SIGTERM since v21
- gunicorn + Django + gevent worker + asyncio code causes SynchronousOnlyOperation error
- log error
- Signal exit log has pid hardcoded in message
- --worker-class eventlet does not successfully switch to websocket, Traceback
- Request hangs in unreader until timeout is reached HOT 1
- How to set hooks when using baseapplication
- events not sent when using morethan 1 gunicorn workers
- AsyncToSync error with Flask Async, Gunicorn and Gevent
- Gunicorn - websockets only doesn't evenly distribute connections to workers
- [ERROR] Socket error processing request. HOT 1
- I'm considering making the Gunicorn website responsive HOT 1
- gunicorn master process to register ephemeral node to zookeeper HOT 1
- Using SCRIPT_NAME causes a Gunicorn error HOT 1
- Trouble with 'worker_exit' hook HOT 1
- worker-class parameter accepts class additionally to class path HOT 3
- "gunicorn not found" error when running a Docker container with pipenv HOT 1
- WebSockets and --max-requests does not reload Workers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gunicorn.