Comments (2)
- That's not a gevent version
- You didn't say what you're doing. A traceback with no context is not a bug report.
from gevent.
I have this same issue with
- gunicorn 20.10
- gevent 24.2.1
- opentelemetry-sdk 1.23.0
- os: macos sonoma, linux
- does not matter if containerized or not
I have yet to find a consistent repro for this but it goes roughly like this. The Flask app needs to perform a handful of requests, and sometimes, it freezes or throws errors, as mentioned earlier.
This is an issue with the opentelemetry instrumentation with gevent workers.
# gunicorn.config.py
from gevent import monkey
monkey.patch_all()
import multiprocessing
import os
from opentelemetry import metrics, trace # noqa: E402 monkey patching must be done before importing Instrumentor
from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import ( # noqa: E402 monkey patching must be done before importing Instrumentor
OTLPMetricExporter,
)
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import ( # noqa: E402 monkey patching must be done before importing Instrumentor
OTLPSpanExporter,
)
from opentelemetry.sdk.metrics import ( # noqa: E402 monkey patching must be done before importing Instrumentor
MeterProvider,
)
from opentelemetry.sdk.metrics.export import ( # noqa: E402 monkey patching must be done before importing Instrumentor
PeriodicExportingMetricReader,
)
from opentelemetry.sdk.resources import ( # noqa: E402 monkey patching must be done before importing Instrumentor
Resource,
)
from opentelemetry.sdk.trace import ( # noqa: E402 monkey patching must be done before importing Instrumentor
TracerProvider,
)
from opentelemetry.sdk.trace.export import ( # noqa: E402 monkey patching must be done before importing Instrumentor
BatchSpanProcessor,
)
workers = 1
worker_class = "gevent"
worker_connections = int(os.getenv("GUNICORN_WORKER_CONNECTIONS", "1000"))
timeout = int(os.getenv("GUNICORN_WORKER_TIMEOUT", "600"))
keepalive = int(os.getenv("GUNICORN_WORKER_KEEPALIVE", "60"))
loglevel = "info"
accesslog = "-"
errorlog = "-"
def post_fork(server, worker):
server.log.info("Worker spawned (pid: %s)", worker.pid)
resource = Resource.create(attributes={"service.name": os.getenv("OTEL_SERVICE_NAME", "lih")})
trace.set_tracer_provider(TracerProvider(resource=resource))
span_processor = BatchSpanProcessor(OTLPSpanExporter(insecure=True))
trace.get_tracer_provider().add_span_processor(span_processor)
reader = PeriodicExportingMetricReader(OTLPMetricExporter())
metrics.set_meter_provider(
MeterProvider(
resource=resource,
metric_readers=[reader],
)
)
# app.py
from flask import Flask, request
from opentelemetry.instrumentation.flask import FlaskInstrumentor
import os
app = Flask(__name__)
FlaskInstrumentor().instrument_app(app)
@app.route("/", methods=["POST"])
def process_request():
data = request.get_json()
do_something_with_data(data)
if __name__ == "__main__":
app.run(debug=os.getenv("FLASK_DEBUG", "False").lower() == "true")
FROM python:3.10
ENV PYTHONBUFFERED 1
COPY . .
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["gunicorn", "-c", "gunicorn.config.py", "--bind", "0.0.0.0:5000", "app:app"]
from gevent.
Facing the same issue. These signatures appear in the log.
from gevent.
Related Issues (20)
- client hang with gevent time out HOT 1
- gevent.exceptions.InvalidSwitchError: Invalid switch into AsyncResult.wait(): None HOT 1
- gevent.timeout.Timeout: 0.0 seconds HOT 3
- Assertion failure in _sempahore.py
- AttributeError: module 'select' has no attribute 'epoll' HOT 2
- TypeError: memoryview: a bytes-like object is required, not 'str' HOT 1
- gevent.hub.LoopExit: This operation would block forever HOT 3
- Bad use of gevent: the Thread has created before patch_all, is_alive() always True HOT 3
- Test units with 0 ran tests (skipped) exit with code 5 on Python 3.12 HOT 7
- Logging lock not released when held by OS threads HOT 3
- error pip install await subprocess HOT 1
- Problem uploading large files: pywsgi.Input.Input._discard reads all input data HOT 1
- Feature request - Queue.abort()
- multiprocessing.event.wait hang after gevent.monkey.patch_all HOT 1
- When running for a long time, the code frequently pending HOT 1
- gevent.exceptions.LoopExit: This operation would block forever HOT 1
- AssertionError: Thread.__init__() not called HOT 2
- 24.2.1 breaking on Github runner HOT 1
- `gevent` gets stuck when `gevent.threadpool` is used inside a fork hook HOT 1
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 gevent.