Skip to content

[17.0] fastapi: Production outages: RuntimeError #514

Open
@JochenVanSeveren

Description

@JochenVanSeveren

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions