opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

python instrumentation Encountering an error

Open chenfangogo opened this issue 5 months ago • 4 comments

When our application is connected to python opentelemetry, it involves azure blob operations, but encounters the following error.

2025-07-10 10:04:19.565 | RecursionError: maximum recursion depth exceeded while calling a Python object

Image

chenfangogo avatar Jul 10 '25 08:07 chenfangogo

Add an error when starting:

/app/api/.venv/lib/python3.11/site-packages/gunicorn/workers/ggevent.py:38: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util.ssl_ (/otel-auto-instrumentation-python/urllib3/util/ssl_.py)', 'aiohttp.web (/app/api/.venv/lib/python3.11/site-packages/aiohttp/web.py)', 'aiohttp.client_exceptions (/app/api/.venv/lib/python3.11/site-packages/aiohttp/client_exceptions.py)', 'aiohttp.connector (/app/api/.venv/lib/python3.11/site-packages/aiohttp/connector.py)', 'aiohttp.client_reqrep (/app/api/.venv/lib/python3.11/site-packages/aiohttp/client_reqrep.py)', 'botocore.httpsession (/app/api/.venv/lib/python3.11/site-packages/botocore/httpsession.py)', 'aiohttp.web_runner (/app/api/.venv/lib/python3.11/site-packages/aiohttp/web_runner.py)', 'urllib3.util (/otel-auto-instrumentation-python/urllib3/util/init.py)', 'redis.asyncio.connection (/app/api/.venv/lib/python3.11/site-packages/redis/asyncio/connection.py)']. monkey.patch_all() Exception ignored in: <bound method _ForkHooks.after_fork_in_child of <gevent.threading._ForkHooks object at 0x7fbffe9425d0>> Traceback (most recent call last): File "/app/api/.venv/lib/python3.11/site-packages/gevent/threading.py", line 359, in after_fork_in_child assert len(active) == 1 ^^^^^^^^^^^^^^^^ AssertionError: 2025-07-10 16:29:04.058 INFO [MainThread] [utils.py:164] - NumExpr defaulting to 16 threads. Exception ignored in: <bound method _ForkHooks.after_fork_in_child of <gevent.threading._ForkHooks object at 0x7fbffe9425d0>> Traceback (most recent call last): File "/app/api/.venv/lib/python3.11/site-packages/gevent/threading.py", line 359, in after_fork_in_child assert len(active) == 1 ^^^^^^^^^^^^^^^^ AssertionError: Exception ignored in: <bound method _ForkHooks.after_fork_in_child of <gevent.threading._ForkHooks object at 0x7fbffe9425d0>> Traceback (most recent call last): File "/app/api/.venv/lib/python3.11/site-packages/gevent/threading.py", line 359, in after_fork_in_child assert len(active) == 1 ^^^^^^^^^^^^^^^^ AssertionError: Exception ignored in: <bound method _ForkHooks.after_fork_in_child of <gevent.threading._ForkHooks object at 0x7fbffe9425d0>> Traceback (most recent call last): File "/app/api/.venv/lib/python3.11/site-packages/gevent/threading.py", line 359, in after_fork_in_child assert len(active) == 1

chenfangogo avatar Jul 10 '25 08:07 chenfangogo

Given that the stack trace has azure/core/tracing/decorator.py, I'm guessing this is an Azure specific issue. @lzchen @jeremydvoss

aabmass avatar Jul 11 '25 21:07 aabmass

Given that the stack trace has azure/core/tracing/decorator.py, I'm guessing this is an Azure specific issue. @lzchen @jeremydvoss

Guys, please help me solve this problem.

chenfangogo avatar Jul 15 '25 01:07 chenfangogo

@lzchen @jeremydvoss please help me solve this problem.

chenfangogo avatar Jul 21 '25 07:07 chenfangogo