Bash

ssh node3 "kill \$(pgrep -f 'build-index.*planet-parallel7' | tail -1) 2>/dev/null; echo killed" && git add builder/src/build_index.cpp && git commit -m "$(cat <<'EOF'
fix: limit backtracking retry to relations with <= 100 sub-ways

Large relations (hundreds of sub-ways) cause the backtracking retry to
stall even with the 500K total budget — a single relation's backtracking
can take minutes. Relations with > 100 sub-ways work fine with greedy
and the 10 missing planet boundaries all have < 100 sub-ways.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
EOF
)" && cat builder/src/build_index.cpp | ssh node3 "cat > /tmp/traccar-geocoder/builder/src/build_index.cpp" && ssh node3 "cd /tmp/traccar-geocoder/builder/build && make -j\$(nproc) 2>&1 | tail -3 && rm -rf ~/planet-parallel8 && mkdir -p ~/planet-parallel8 && nohup /tmp/traccar-geocoder/builder/build/build-index ~/planet-parallel8 ~/pbf/planet.osm.pbf --parallel-admin > ~/planet-parallel8.log 2>&1 & echo started" 2>&1

Fix, commit, build, start


Command running in background with ID: buify18q9. Output is being written to: /tmp/claude-0/-root-traccar-geocoder/af1c4baa-0f9a-4420-a8b3-ce20dc28c8b9/tasks/buify18q9.output


sleep 10 && cat /tmp/claude-0/-root-traccar-geocoder/af1c4baa-0f9a-4420-a8b3-ce20dc28c8b9/tasks/buify18q9.output 2>/dev/null

Check start


killed
[main a80d4e9] fix: limit backtracking retry to relations with <= 100 sub-ways
 1 file changed, 2 insertions(+), 2 deletions(-)
started
      |           ^~~~~~~~
[100%] Linking CXX executable build-index
[100%] Built target build-index


Build started. Let me monitor — if the 100 sub-way limit works, it should fly past 770K.


sleep 600 && ssh node3 "grep -E 'Assembled 77|Assembled 78|Parallel admin|polygon|Done|Writing' ~/planet-parallel8.log | tail -5; ps aux | grep 'build-index.*planet-parallel8' | grep -v grep | awk '{print \$3\"% CPU\", \$10}'" 2>&1

Check after 10 min


  Added 15275 admin polygons from closed ways.
  Assembling admin polygons in parallel (778863 relations, 3098498 way geometries)...
  Assembled 770K admin relations...
0.0% CPU 0:00
1360% CPU 151:05


Still at 770K! But it's only been 10 min (151 min CPU time / 13.6 cores = ~11 min wall time). Let me check if it's progressing or stuck.


ssh node3 "grep -c 'Assembled 78' ~/planet-parallel8.log; sleep 10; grep -c 'Assembled 78' ~/planet-parallel8.log" 2>&1

Quick progress check


Exit code 1
0
0


Still stuck. The greedy pass itself is stuck at 770K, not the backtracking retry. There must be a greedy stall too — a relation where greedy enters an infinite loop or takes extremely long.


ssh node3 "tail -5 ~/planet-parallel8.log" 2>&1

Check latest log


  WARN: relation 'Poruba' (level 9, 22 members): 0 rings from 22 ways (22 found, 0 missing)
  DEBUG 'Třebovice': ways: [w663144225 first=1920821168 last=1920821263 n=58] [w181926175 first=1920821263 last=1922657433 n=5] [w231091720 first=1922657433 last=1922657440 n=12] [w253130622 first=658654271 last=1922657440 n=15] [w51648223 first=1922371430 last=658654271 n=15] [w181883295 first=1902725921 last=1922371430 n=22] [w179843468 first=1902725921 last=1902725688 n=12] [w231091743 first=1902725688 last=1899233653 n=72] [w179550256 first=1899234061 last=1899233653 n=32] [w181668476 first=1899234061 last=1920821197 n=4] [w231091744 first=1920821197 last=1920821169 n=21]
  WARN: relation 'Třebovice' (level 9, 11 members): 0 rings from 11 ways (11 found, 0 missing)
  DEBUG 'Svinov': ways: [w231091744 first=1920821197 last=1920821169 n=21] [w181668476 first=1899234061 last=1920821197 n=4] [w231091742 first=1899233786 last=1899234061 n=74] [w181668483 first=1896666583 last=1899233786 n=270] [w181668457 first=1896666569 last=1896666583 n=178] [w181668469 first=1896439537 last=1896666569 n=38] [w179303115 first=1896439537 last=1896440664 n=34] [w181668471 first=1920821263 last=1896440664 n=19] [w663144225 first=1920821168 last=1920821263 n=58]
  WARN: relation 'Svinov' (level 9, 9 members): 0 rings from 9 ways (9 found, 0 missing)


The log stops at the same Poruba/Třebovice/Svinov relations as before. The greedy pass completed for all 770K+ relations. The hang is in the **backtracking retry** — some relation at this point has < 100 sub-ways but the backtracking still takes forever.

The Třebovice relation has 11 members → after splitting, probably ~20-30 sub-ways. With backtracking depth 200 and branching factor of 3-4, the search space is 4^200. The 100K per-ring budget + 500K total isn't enough.

The fix: reduce the sub-way limit further. These Czech district relations (Třebovice, Svinov, Poruba) are in Ostrava and have complex topology. Let me set the limit to 30.


Edit

if (any_unused && sub_ways.size() <= 100) {

if (any_unused && sub_ways.size() <= 30) {