-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Bug Description
OpenViking server crashes when processing certain requests that result in floating-point infinity (inf) values during vector similarity calculations or other numerical operations.
Error Log
2026-03-22 16:18:58,328 - openviking.server.app - WARNING - Unhandled exception: Out of range float values are not JSON compliant: inf
2026-03-22 16:18:58,331 - uvicorn.error - ERROR - Exception in ASGI application
...
ValueError: Out of range float values are not JSON compliant: inf
Root Cause Analysis
- During vector similarity computation or other numerical operations, the system produces
inf(infinity) as a result - This typically occurs due to division by zero or edge cases in similarity calculations
- When the server attempts to serialize the response to JSON, it fails because JSON standard does not support
infvalues - The unhandled exception causes the server to crash
Environment
- OpenViking version: 0.2.9
- Python version: 3.13
- Embedding model: BAAI/bge-m3 (via SiliconFlow API)
- VLM: kimi-k2.5 (via Aliyun API)
Suggested Fix
Handle infinity values before JSON serialization:
- Check for
infand-infvalues in numerical results - Replace with appropriate sentinel values (e.g.,
null, max/min float, or a special indicator) - Or use a custom JSON encoder that handles infinity values gracefully
Example fix pattern:
import math
def sanitize_for_json(obj):
if isinstance(obj, float):
if math.isinf(obj):
return None # or str(obj) for "inf"/"-inf"
return objImpact
Server crash requires manual restart. This affects service reliability, especially for production deployments.
Workaround
Use a process manager (systemd/pm2) with auto-restart capability to recover from crashes automatically.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done