Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(worker): run tini as PID 1 so sandbox zombies get reaped (#16561)

Abdulc63706c37d52
diff --git a/Dockerfile b/Dockerfile
index 5a631cfd751..21d92991b40 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,6 +21,7 @@ RUN printf 'deb http://snapshot.debian.org/archive/debian/20260825T000000Z bulls
# node base image wipes /var/cache/apt anyway, and a persisted /var/lib/apt/lists goes stale
# against rotated bullseye-security packages, failing the build with hash/size fetch errors.
# libcap2 is isolate's runtime lib (the isolate binaries ship prebuilt in api assets).
+# tini runs as PID 1 and reaps orphaned sandbox children; node as PID 1 never waits on them and they pile up as zombies.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openssh-client \
@@ -31,6 +32,7 @@ RUN apt-get update && \
poppler-utils \
poppler-data \
procps \
+ tini \
unzip \
curl \
ca-certificates \
@@ -165,5 +167,5 @@ LABEL service=activepieces
HEALTHCHECK --interval=10s --timeout=5s --start-period=60s --retries=5 \
CMD [ "$AP_CONTAINER_TYPE" = "WORKER" ] && exit 0 || curl -fsS "http://localhost:${AP_PORT:-80}/api/v1/health" || exit 1
-ENTRYPOINT ["./docker-entrypoint.sh"]
+ENTRYPOINT ["tini", "--", "./docker-entrypoint.sh"]
EXPOSE 80
diff --git a/Dockerfile.worker b/Dockerfile.worker
index a8f5e9480f4..239a6cc7bf5 100644
--- a/Dockerfile.worker
+++ b/Dockerfile.worker
@@ -64,8 +64,9 @@ RUN printf 'deb http://snapshot.debian.org/archive/debian/20260825T000000Z bulls
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99snapshot
# ca-certificates: TLS for piece downloads. procps: `ps`, which tree-kill spawns to reap the engine.
+# tini: PID 1 that reaps orphaned sandbox children; node as PID 1 never waits on them and they pile up as zombies.
RUN apt-get update && \
- apt-get install -y --no-install-recommends ca-certificates procps && \
+ apt-get install -y --no-install-recommends ca-certificates procps tini && \
rm -rf /var/lib/apt/lists/*
# esbuild (JS API) compiles CODE steps; at /node_modules so --external:esbuild worker.js resolves it, like isolated-vm.
@@ -91,4 +92,4 @@ COPY --from=build /usr/src/app/dist/packages/engine ./dist/packages/engine
COPY --from=build /usr/src/app/package.json ./package.json
LABEL service=activepieces-worker
-ENTRYPOINT ["node", "worker.js"]
+ENTRYPOINT ["tini", "--", "node", "worker.js"]