[17.0] fastapi: Production outages: RuntimeError
Module
fastapi
Describe the bug
2025-03-27 11:15:26,319 13776 ERROR my-odoo-instance odoo.http: Exception during request handling.
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/tools/cache.py", line 99, in lookup
r = d[key]
File "<decorator-gen-5>", line 2, in __getitem__
File "/home/odoo/src/odoo/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/tools/lru.py", line 34, in __getitem__
a = self.d[obj]
KeyError: ('fastapi.endpoint', <function FastapiEndpoint.get_app at 0x7fbe3e2e2710>, '/app')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 2213, in __call__
response = request._serve_db()
File "/home/odoo/src/odoo/odoo/http.py", line 1788, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/home/odoo/src/odoo/odoo/service/model.py", line 152, in retrying
result = func()
File "/home/odoo/src/odoo/odoo/http.py", line 1816, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/home/odoo/src/user/OCA/rest-framework/extendable_fastapi/fastapi_dispatcher.py", line 19, in dispatch
return super().dispatch(endpoint, args)
File "/home/odoo/src/user/OCA/rest-framework/fastapi/fastapi_dispatcher.py", line 28, in dispatch
app = fastapi_endpoint.get_app(root_path)
File "<decorator-gen-126>", line 2, in get_app
File "/home/odoo/src/odoo/odoo/tools/cache.py", line 104, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/odoo/src/user/OCA/rest-framework/fastapi/models/fastapi_endpoint.py", line 216, in get_app
return ASGIMiddleware(app)
File "/home/odoo/.local/lib/python3.10/site-packages/a2wsgi/asgi.py", line 131, in __init__
loop_threading.start()
File "/usr/lib/python3.10/threading.py", line 935, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't start new thread
To Reproduce
This occured a couple of times already in production and the error repeats itself untill the server is restarted.
Additional context Let me know if additional context is needed.
Maybe this is #484
Thank you Stéphane. Seems it could be the case. It's quite hard to tell any resource induced outages the Odoo.sh monitoring tab. Then again, it's not that accurate of a tool.
How can I help merge #486 into 17.0? My knowledge doesn't go further then basic threads. Not afraid to give it a shot though.
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.