mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-12 13:29:37 +02:00
validate_url() calls socket.getaddrinfo() for SSRF protection, which blocks the event loop for 100-700ms per DNS lookup. This affects: - Image generation (get_image_data) — every external image URL - Image editing (load_url_image) — every external image URL - OAuth profile pictures (_process_picture_url) — every login - Webhook delivery (post_webhook) — every notification - Image base64 conversion (get_image_base64_from_url) — chat images Wrap all 5 async call sites in asyncio.to_thread() so DNS resolution runs in the thread pool. The event loop remains free to serve other requests during the lookup. Benchmark (3 domains, 3 trials averaged): - BEFORE: max jitter 479ms, 1 blocked ping per trial - AFTER: max jitter 1ms, 0 blocked pings (324x improvement) Co-authored-by: Tim Baek <tim@openwebui.com>