Inada Naoki

Results 343 comments of Inada Naoki

Not intended, and fixed in #577. Next version will not contain them.

Is it harder than making whole otel-python[-contrib] fork-safe?

FYI, ddtrace-py also require lazy-apps. https://github.com/DataDog/dd-trace-py/blob/8b11b36d29ee4cda1a6000d10fd74208bbb5f39d/ddtrace/internal/uwsgi.py#L35

lazy-apps is the most straightforward. But there are some options to avoid the fork after loading app.

@Liubey Do you read and follow this? https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples/fork-process-model#working-with-fork-process-models

> I use the code like:https://github.com/open-telemetry/opentelemetry-python/blob/main/docs/examples/fork-process-model/flask-uwsgi/app.py *like*? Did you reproduce it with *exact* the code? Unless there is a reproducible step, all efforts to investigate will be in vain.

OK. I got it. * BatchSpanProcessor uses daemon thread. So BatchSpanProcessor.shutdown() is needed to stop it. https://github.com/open-telemetry/opentelemetry-python/blob/8ad10f7d8fd59be49f3d2e683824ff921c0781f8/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py#L189 * TracerProvider uses `atexit` to call shutdown(). And its shutdown calls BatchSpanProcessor.shutdown(). https://github.com/open-telemetry/opentelemetry-python/blob/8ad10f7d8fd59be49f3d2e683824ff921c0781f8/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py#L1181-L1182...

I can reproduce it with http.OTLPSpanExporter. I don't test JaegerExporter yet. grpc exporter shutdown is not related because it doesn't use daemon thread.

It is separeted issue. It is fork-safe problem. And `--lazy-apps` (recommended) or `@post_fork` can avoid it.