From fc92782d711609596c95e7588ff742e5e3a76b81 Mon Sep 17 00:00:00 2001 From: David Barratt Date: Sun, 4 Oct 2026 20:04:55 +0000 Subject: [PATCH 1/2] Remove orphaned /dev/shm/osm3s_osm_base on container start, like the existing osm3s_areas cleanup When a container dies uncleanly (SIGKILL, node reboot, container-runtime restart) or runs on a runtime where /dev/shm persists across container restarts, a leftover /dev/shm/osm3s_osm_base object prevents the main dispatcher from ever starting again (shm_open with O_EXCL fails with EEXIST -> File_Error 'File exists'). Supervisord then marks overpass_dispatch FATAL after its default 3 start retries and never recovers. The entrypoint already sweeps exactly this failure class for the areas dispatcher object (osm3s_areas); extend the same block to cover osm3s_osm_base. At the container boot boundary, presence of either object means it is stale. On runtimes with a fresh per-container /dev/shm (Docker/runc default), the loop is a no-op; on runtimes where /dev/shm persists, boot self-heals instead of wedging. Fixes wiktorn/Overpass-API#174 --- docker-entrypoint.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 55f785c..2f2e9ef 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -38,10 +38,17 @@ for f in /docker-entrypoint-initdb.d/*; do done # deleting areas file if present. Otherwise the link to /db/db/osm3s_vX.X.X_areas will not be created and the area is not availible. -if [ -f /dev/shm/osm3s_areas ]; then - echo "Found orphaned /dev/shm/osm3s_areas file. Deleting it." - rm /dev/shm/osm3s_areas -fi +# Same for the main dispatcher's guard: a dispatcher that dies uncleanly +# (SIGKILL, node reboot, container-runtime restart) leaves its POSIX shm +# object behind, and on runtimes where /dev/shm persists across container +# restarts, every subsequent start fails with "File_Error File exists 17". +# At the container boundary, presence of either object means it is stale. +for name in osm3s_osm_base osm3s_areas; do + if [ -f "/dev/shm/$name" ]; then + echo "Found orphaned /dev/shm/$name file. Deleting it." + rm "/dev/shm/$name" + fi +done if [[ ! -f /db/init_done ]]; then echo "No database directory. Initializing" From 8cf9de2174555c218cc1bc2176f52e9e27efbe11 Mon Sep 17 00:00:00 2001 From: David Barratt Date: Sun, 4 Oct 2026 20:19:43 +0000 Subject: [PATCH 2/2] Fix "availible" typo in orphaned shm cleanup comment --- docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2f2e9ef..0e7ef3a 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -37,7 +37,7 @@ for f in /docker-entrypoint-initdb.d/*; do echo done -# deleting areas file if present. Otherwise the link to /db/db/osm3s_vX.X.X_areas will not be created and the area is not availible. +# deleting areas file if present. Otherwise the link to /db/db/osm3s_vX.X.X_areas will not be created and the area is not available. # Same for the main dispatcher's guard: a dispatcher that dies uncleanly # (SIGKILL, node reboot, container-runtime restart) leaves its POSIX shm # object behind, and on runtimes where /dev/shm persists across container