lablup / lablup/backend.ai

Reclaimed circuits in App Proxy should return 404/503 instead of 500 when accessed

Open
#5,294 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

Making HTTP requests to reclaimed circuits results in:

```
2025-07-27 22:55:52.835 ERROR aiohttp.server [939529] Error handling request from 127.0.0.1
Traceback (most recent call last):
File "/home/joongi/bai-edge/dist/export/python/virtualenvs/python-default/3.13.3/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joongi/bai-edge/dist/export/python/virtualenvs/python-default/3.13.3/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/joongi/bai-edge/dist/export/python/virtualenvs/python-default/3.13.3/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/joongi/bai-edge/src/ai/backend/appproxy/worker/proxy/frontend/http/port.py", line 102, in ensure_slot_middleware
return await self.exception_safe_handler_wrapper(request, _exception_safe_handler)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joongi/bai-edge/src/ai/backend/appproxy/worker/proxy/frontend/http/abc.py", line 106, in exception_safe_handler_wrapper
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/joongi/bai-edge/src/ai/backend/appproxy/worker/proxy/frontend/http/port.py", line 92, in _exception_safe_handler
circuit = self.circuits[port]
~~~~~~~~~~~~~^^^^^^
KeyError: 10240
2025-07-27 22:55:52.835 INFO aiohttp.access [939529] 127.0.0.1 [27/Jul/2025:22:55:52 +0900] "POST /v1/chat/completions HTTP/1.1" 500 324 "-" "python-requests/2.32.4"
```

This should be 404. Considering the nature of proxy, it could be 503 (service temporarily unavailable) or similar.

At least, it shouldn’t be 500 (internal server error).

JIRA Issue: BA-1994

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.