[GH-ISSUE #21334] Bug: Latency of base model connection could cause all base models not to appear #34974

Closed
opened 2026-04-25 09:09:28 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @antpar-rf on GitHub (Feb 12, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21334

Bug: Latency of one base models could cause all base models not to appear & increasing timeout could cause issues with event loop.

2b26355002/backend/open_webui/routers/openai.py (L416)

  1. asyncio.gather() behavior: The code uses responses = await asyncio.gather(*request_tasks) . By default, asyncio.gather() will propagate the first exception it encounters and cancel remaining tasks, which would cause the entire function to fail.

  2. Exception handling in send_get_request: When a timeout or client error occurs in send_get_request, it raises an HTTPException [1]:

    except aiohttp.ClientError as e:
        log.exception(f"Client error: {str(e)}")
        raise HTTPException(
            status_code=500, detail="Open WebUI: Server Connection Error"
        )
    
  3. Impact on multiple base models: If you have 5-10 base models and one times out, the exception will propagate up and the entire get_all_models_responses function will fail, not return partial results.

To make it resilient, the code would need to either:

  • Use asyncio.gather(*request_tasks, return_exceptions=True) to capture exceptions as values instead of propagating them
  • Wrap individual tasks in try-except blocks to handle failures gracefully

As currently written, one timeout will cause the entire model retrieval operation to fail rather than returning results from the successful requests.

Originally created by @antpar-rf on GitHub (Feb 12, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/21334 ### Bug: Latency of one base models could cause all base models not to appear & increasing timeout could cause issues with event loop. https://github.com/open-webui/open-webui/blob/2b26355002064228e9b671339f8f3fb9d1fafa73/backend/open_webui/routers/openai.py#L416 1. **`asyncio.gather()` behavior**: The code uses `responses = await asyncio.gather(*request_tasks)` . By default, `asyncio.gather()` will propagate the first exception it encounters and cancel remaining tasks, which would cause the entire function to fail. 2. **Exception handling in `send_get_request`**: When a timeout or client error occurs in `send_get_request`, it raises an `HTTPException` [1]: ```python except aiohttp.ClientError as e: log.exception(f"Client error: {str(e)}") raise HTTPException( status_code=500, detail="Open WebUI: Server Connection Error" ) ``` 3. **Impact on multiple base models**: If you have 5-10 base models and one times out, the exception will propagate up and **the entire `get_all_models_responses` function will fail**, not return partial results. **To make it resilient**, the code would need to either: - Use `asyncio.gather(*request_tasks, return_exceptions=True)` to capture exceptions as values instead of propagating them - Wrap individual tasks in try-except blocks to handle failures gracefully As currently written, **one timeout will cause the entire model retrieval operation to fail** rather than returning results from the successful requests.
Author
Owner

@Classic298 commented on GitHub (Feb 12, 2026):

Thanks for the report! This has actually already been addressed in dev it seems.

The send_get_request function catches all exceptions and returns None instead of raising an HTTPException:

    except Exception as e:
        log.error(f"Connection error: {e}")
        return None

Because of this, asyncio.gather will never see an exception propagate from a timed-out or failing connection - it simply receives None for that slot. The downstream code already handles this by skipping None responses, so models from all other successful providers are still returned normally.

Closing as already resolved. If you're still experiencing this on the latest version, please reopen with reproduction steps for the dev branch and we can take another look.

<!-- gh-comment-id:3892804703 --> @Classic298 commented on GitHub (Feb 12, 2026): Thanks for the report! This has actually already been addressed in dev it seems. The send_get_request function catches all exceptions and returns None instead of raising an HTTPException: ``` except Exception as e: log.error(f"Connection error: {e}") return None ``` Because of this, asyncio.gather will never see an exception propagate from a timed-out or failing connection - it simply receives None for that slot. The downstream code already handles this by skipping None responses, so models from all other successful providers are still returned normally. Closing as already resolved. If you're still experiencing this on the latest version, please reopen with reproduction steps for the dev branch and we can take another look.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#34974