Trail editor: "Couldn't reach the pace engine" (POST /api/v1/trail-analyze/analyze -> 504 after 120 s) #47

Closed
opened 2026-11-04 18:56:17 +00:00 by maximus · 2 comments
Member

Reported by Jörg 2026-11-04 ~18:55Z on https://wanderer.bearoverse.com/trail/edit/new (Firefox).

Repro: new trail, set two points (valhalla route + height succeed: POST /api/v1/valhalla/route 200, /api/v1/valhalla/height 200), then the editor calls POST /api/v1/trail-analyze/analyze, which hangs and returns 504 after 120085 ms. UI: "Couldn't reach the pace engine." Console: Error: analyze failed (504).

Other calls OK: /api/v1/list, /api/v1/plugin-system/plugins, /api/v1/plugin-instance, geocoding/reverse, styles/komoot.json.

To find: which backend serves trail-analyze (pace engine service/plugin), whether it runs and is reachable from the wanderer web pod (NetworkPolicy, DNS, service name after the k3s/Sospel moves), its logs, and the 120 s gateway timeout.

🤖 Generated with Claude Code

Reported by Jörg 2026-11-04 ~18:55Z on https://wanderer.bearoverse.com/trail/edit/new (Firefox). Repro: new trail, set two points (valhalla route + height succeed: POST /api/v1/valhalla/route 200, /api/v1/valhalla/height 200), then the editor calls `POST /api/v1/trail-analyze/analyze`, which hangs and returns **504 after 120085 ms**. UI: "Couldn't reach the pace engine." Console: `Error: analyze failed (504)`. Other calls OK: /api/v1/list, /api/v1/plugin-system/plugins, /api/v1/plugin-instance, geocoding/reverse, styles/komoot.json. To find: which backend serves trail-analyze (pace engine service/plugin), whether it runs and is reachable from the wanderer web pod (NetworkPolicy, DNS, service name after the k3s/Sospel moves), its logs, and the 120 s gateway timeout. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Member

Root cause (504 "Couldn't reach the pace engine")

The request path itself was fine: wanderer-web /api/v1/trail-analyze/analyze → trail-analyze-web (nginx) → elevation-profiler:8000, all on the Monaco k3s, no NetworkPolicy involved, DNS fine. The engine was simply too slow:

  • IGN withdrew the WFS namespace IGNF_MNT-LIDAR-HD:dalle. Every LiDAR tile lookup now answers 400 "Unknown namespace [IGNF_MNT-LIDAR-HD]".
  • The sampler treated that as transient, left the 1 km cell uncached and retried the lookup for every densified point (5 m spacing, so about 200 per km, 2 attempts each) before falling back to RGE ALTI. A 1 km route took 49 s. Your route ran past the 120 s limit in both wanderer's proxy (ANALYZE_TIMEOUT_MS) and nginx (proxy_read_timeout 120s). nginx logged 499 at exactly 120 s.
  • HTTPError responses were never closed either: about 850 sockets to data.geopf.fr sat in CLOSE_WAIT in the pod.

Fix

jmz/homelab-flux#819 (CI green, waiting for Jörg's merge). Dalles now come straight from the WMS layer IGNF_LIDAR-HD_MNT_ELEVATION.ELEVATIONGRIDCOVERAGE.LAMB93, which returns pixels identical to the cached tiles. Each tile gets one fetch attempt per analysis, error responses are closed, 4xx are not retried, and the timeout is 20 s per attempt. A pod annotation rolls the profiler.

Tested in the live pod with the new code: Sospel → Col de Braus (7.6 km) took 0.9 s cold, Monaco → La Turbie took 1.2 s, lidar_pct 100 / 99.8.

Browser-log follow-ups

#48 into deploy (CI green; needs jmz to merge because deploy is protected, then an image build and a flux digest bump):

  • 500 on /trail/edit/<unknown id> (the devtools source-map probe) → 4xx
  • Fallback avatars from api.dicebear.com (leaked usernames) → local SVG
  • "There is no style added to the map." → isMapStyleLoaded guard
  • getElementById("") → no empty label for
  • XML Parsing Error: upstream isomorphic-xml2js dist/lib/parser.js:12 (an intentional 'INVALID' probe at load), harmless
  • user-select: undefined: upstream maplibre-gl src/util/dom.ts:90-92 (enableDrag without a prior disableDrag), harmless
  • file:/// security error: devtools extension, no app reference
  • 304 on /trail/edit/new: SvelteKit ETag revalidation, expected
  • CSS -moz-* / -webkit-* warnings: Tailwind and maplibre-gl.css vendor prefixes, harmless

I'll close this once #819 is deployed and the analyze call is verified.

🤖 Generated with Claude Code

## Root cause (504 "Couldn't reach the pace engine") The request path itself was fine: wanderer-web `/api/v1/trail-analyze/analyze` → `trail-analyze-web` (nginx) → `elevation-profiler:8000`, all on the Monaco k3s, no NetworkPolicy involved, DNS fine. The engine was simply too slow: - IGN withdrew the WFS namespace `IGNF_MNT-LIDAR-HD:dalle`. Every LiDAR tile lookup now answers **400 "Unknown namespace [IGNF_MNT-LIDAR-HD]"**. - The sampler treated that as transient, left the 1 km cell uncached and retried the lookup **for every densified point** (5 m spacing, so about 200 per km, 2 attempts each) before falling back to RGE ALTI. A 1 km route took 49 s. Your route ran past the 120 s limit in both wanderer's proxy (`ANALYZE_TIMEOUT_MS`) and nginx (`proxy_read_timeout 120s`). nginx logged 499 at exactly 120 s. - HTTPError responses were never closed either: about 850 sockets to data.geopf.fr sat in CLOSE_WAIT in the pod. ## Fix jmz/homelab-flux#819 (CI green, waiting for Jörg's merge). Dalles now come straight from the WMS layer `IGNF_LIDAR-HD_MNT_ELEVATION.ELEVATIONGRIDCOVERAGE.LAMB93`, which returns pixels identical to the cached tiles. Each tile gets one fetch attempt per analysis, error responses are closed, 4xx are not retried, and the timeout is 20 s per attempt. A pod annotation rolls the profiler. Tested in the live pod with the new code: Sospel → Col de Braus (7.6 km) took 0.9 s cold, Monaco → La Turbie took 1.2 s, lidar_pct 100 / 99.8. ## Browser-log follow-ups #48 into `deploy` (CI green; needs jmz to merge because `deploy` is protected, then an image build and a flux digest bump): - [x] 500 on `/trail/edit/<unknown id>` (the devtools source-map probe) → 4xx - [x] Fallback avatars from api.dicebear.com (leaked usernames) → local SVG - [x] "There is no style added to the map." → `isMapStyleLoaded` guard - [x] `getElementById("")` → no empty `label for` - XML Parsing Error: upstream `isomorphic-xml2js` `dist/lib/parser.js:12` (an intentional `'INVALID'` probe at load), harmless - `user-select: undefined`: upstream maplibre-gl `src/util/dom.ts:90-92` (`enableDrag` without a prior `disableDrag`), harmless - `file:///` security error: devtools extension, no app reference - 304 on `/trail/edit/new`: SvelteKit ETag revalidation, expected - CSS `-moz-*` / `-webkit-*` warnings: Tailwind and maplibre-gl.css vendor prefixes, harmless I'll close this once #819 is deployed and the analyze call is verified. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jmz closed this issue 2026-11-04 20:48:11 +00:00
Author
Member

Verified live 2026-11-04 21:15Z after homelab-flux #819 (elevation-profiler on the LiDAR-HD WMS layer, no retry storm): POST /analyze 200 in 0.7-1.5 s on 3 routes (sospel-braus 7.6 km lidar 100 %, sospel-ventabren 4.7 km 99.8 %, monaco-turbie 3.6 km 99.8 %), was 504 after 120 s. Closing. The browser-log items continue in public/wanderer#48.

🤖 Generated with Claude Code

Verified live 2026-11-04 21:15Z after homelab-flux #819 (elevation-profiler on the LiDAR-HD WMS layer, no retry storm): POST /analyze 200 in 0.7-1.5 s on 3 routes (sospel-braus 7.6 km lidar 100 %, sospel-ventabren 4.7 km 99.8 %, monaco-turbie 3.6 km 99.8 %), was 504 after 120 s. Closing. The browser-log items continue in public/wanderer#48. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/wanderer#47
No description provided.