Repository navigation
Closed as not planned
Labels
Description
How do you use Sentry?
Sentry Saas (sentry.io)
Version
1.39.2
Steps to Reproduce
I have a working app under 3.11 and upgrade to 3.12 leads to this trace.
I'm not positive it's sentry, might be opentelemetry but since the 1st lib to popup in the trace is sentry I decided on putting this here :)
#2299 looks quite close though not the exact same
Expected Result
app to start !
Actual Result
backend_1 | Traceback (most recent call last):
backend_1 | File "/opt/venv/bin/uvicorn", line 8, in <module>
backend_1 | sys.exit(main())
backend_1 | ^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
backend_1 | return self.main(*args, **kwargs)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
backend_1 | rv = self.invoke(ctx)
backend_1 | ^^^^^^^^^^^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
backend_1 | return ctx.invoke(self.callback, **ctx.params)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
backend_1 | return __callback(*args, **kwargs)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/uvicorn/main.py", line 416, in main
backend_1 | run(
backend_1 | File "/opt/venv/lib/python3.12/site-packages/uvicorn/main.py", line 587, in run
backend_1 | server.run()
backend_1 | File "/opt/venv/lib/python3.12/site-packages/uvicorn/server.py", line 61, in run
backend_1 | return asyncio.run(self.serve(sockets=sockets))
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
backend_1 | return runner.run(main)
backend_1 | ^^^^^^^^^^^^^^^^
backend_1 | File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
backend_1 | return self._loop.run_until_complete(task)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend_1 | File "/opt/venv/lib/python3.12/site-packages/uvicorn/server.py", line 68, in serve
backend_1 | config.load()
backend_1 | File "/opt/venv/lib/python3.12/site-packages/uvicorn/config.py", line 467, in load
backend_1 | self.loaded_app = import_from_string(self.app)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/uvicorn/importer.py", line 21, in import_from_string
backend_1 | module = importlib.import_module(module_str)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
backend_1 | return _bootstrap._gcd_import(name[level:], package, level)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
backend_1 | File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
backend_1 | File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
backend_1 | File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
backend_1 | File "<frozen importlib._bootstrap_external>", line 994, in exec_module
backend_1 | File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
backend_1 | File "/opt/project/sfjapi/myapp.py", line 7, in <module>
backend_1 | app = get_app(app_settings=app_settings, auth_settings=auth_settings)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/opt/project/sfjapi/main.py", line 192, in get_app
backend_1 | trace.set_tracer_provider(TracerProvider())
backend_1 | ^^^^^^^^^^^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/opentelemetry/sdk/trace/__init__.py", line 1148, in __init__
backend_1 | self._resource = Resource.create({})
backend_1 | ^^^^^^^^^^^^^^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/opentelemetry/sdk/resources/__init__.py", line 199, in create
backend_1 | resource = get_aggregated_resources(
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/opt/venv/lib/python3.12/site-packages/opentelemetry/sdk/resources/__init__.py", line 387, in get_aggregated_resources
backend_1 | futures = [executor.submit(detector.detect) for detector in detectors]
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 179, in submit
backend_1 | self._adjust_thread_count()
backend_1 | File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 202, in _adjust_thread_count
backend_1 | t.start()
backend_1 | File "/opt/venv/lib/python3.12/site-packages/sentry_sdk/integrations/threading.py", line 56, in sentry_start
backend_1 | return old_start(self, *a, **kw)
backend_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
backend_1 | File "/usr/local/lib/python3.12/threading.py", line 992, in start
backend_1 | _start_new_thread(self._bootstrap, ())
backend_1 | RuntimeError: can't start new thread
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsWaiting for: Community
Activity
sentrivana commentedon Jan 11, 2024
Hey @euri10, thanks for reporting. If you comment out the Sentry SDK init, does the app start?
euri10 commentedon Jan 11, 2024
yes, I just removed sentry from the equation and the app starts fine
sentrivana commentedon Jan 11, 2024
@euri10 Thanks for verifying! Could you provide a code snippet to help us repro this? I don't have much to go on other than that you're running uvicorn and opentelemetry.
6 remaining items
sentrivana commentedon Jan 11, 2024
@euri10 I think this will be hard to reproduce locally since at least based on the stacktrace it seems like an issue with the environment not allowing the app to spawn new threads for whatever reason. Cloud environs might have restrictions on this sort of thing.
Can you try disabling the threading integration and seeing if that makes the app start? To do that you need to disable all default integrations with
default_integrations=Falsesince they're auto enabled.Additionally, looking at your app factory, this is a FastAPI app, right? Then you shouldn't need the ASGI middleware; we have a dedicated FastAPI integration that will be auto-enabled when you
initthe SDK.getsantry commentedon Feb 2, 2024
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label
Waiting for: Community, I will leave it alone ... forever!"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀