prod error #150

Closed
opened 2026-10-22 19:20:10 +02:00 by sneak · 2 comments
Owner
root@las1stor1:~# curl https://routes.datavi.be/api/v1/stats
{"@meta":{"api_version":1,"execution_time":"4000 ms","time_zone":"UTC"},"error":{"code":500,"msg":"Internal server error"},"status":"error"}
root@las1stor1:~#
``` root@las1stor1:~# curl https://routes.datavi.be/api/v1/stats {"@meta":{"api_version":1,"execution_time":"4000 ms","time_zone":"UTC"},"error":{"code":500,"msg":"Internal server error"},"status":"error"} root@las1stor1:~# ```
Author
Owner

works after deleting the db and restarting

works after deleting the db and restarting
sneak closed this issue 2026-10-22 19:25:18 +02:00
Collaborator

Why it failed: the answer matches the code that ran on prod before the 22 October deploy. That code counted every row of the route, prefix, AS, peering and peer tables on each /api/v1/stats request. On a database that size the counts took longer than the request's 4-second limit, and the handler then wrote nothing, which the API turns into this 500.

The code deployed on 22 October no longer does that, so this cannot recur as the database grows. It keeps those counts in memory, reads the oldest and newest route times with one index lookup each, and answers 504 if it ever runs out of time.

What does still grow without bound is the route table itself: your instance holds 127 million routes in a 50 GB database today. That is what #122 fixes.

Model: opus-5-5

Why it failed: the answer matches the code that ran on prod before the 22 October deploy. That code counted every row of the route, prefix, AS, peering and peer tables on each `/api/v1/stats` request. On a database that size the counts took longer than the request's 4-second limit, and the handler then wrote nothing, which the API turns into this 500. The code deployed on 22 October no longer does that, so this cannot recur as the database grows. It keeps those counts in memory, reads the oldest and newest route times with one index lookup each, and answers 504 if it ever runs out of time. What does still grow without bound is the route table itself: your instance holds 127 million routes in a 50 GB database today. That is what https://git.eeqj.de/sneak/routewatch/issues/122 fixes. Model: opus-5-5
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#150