Skip to content

Commit 43825b0

Browse files
committed
remove sleep infinity idle_timeout - prevents modal idle_timeout
1 parent 4ee1842 commit 43825b0

2 files changed

Lines changed: 3 additions & 19 deletions

File tree

runner/config.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,6 @@
9494
# Backoff delays in seconds for sandbox spawn retries (exponential)
9595
SANDBOX_RETRY_BACKOFF = [1, 2, 4]
9696

97-
# Sandbox idle timeout — keeps sandbox warm after runner exits, avoids full cold start
98-
# for subsequent jobs. The sandbox entrypoint stays alive (dockerd + keepalive) after
99-
# the runner completes. If no new job claims it within this window, Modal auto-terminates.
100-
# Default: 5 minutes. Set to 0 to disable.
101-
try:
102-
IDLE_TIMEOUT_SECONDS = max(0, int(os.environ.get("IDLE_TIMEOUT_SECONDS", "300")))
103-
except ValueError:
104-
logging.getLogger("runner").warning("Invalid IDLE_TIMEOUT_SECONDS; using default=300")
105-
IDLE_TIMEOUT_SECONDS = 300
106-
10797

10898
def get_gpu_config(gpu_key: str):
10999
"""Resolve a GPU label key to a Modal GPU config object."""

runner/services/sandbox_service.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
ALLOWED_CIDRS,
88
BLOCK_NETWORK,
99
CACHE_VOLUME_NAME,
10-
IDLE_TIMEOUT_SECONDS,
1110
MODAL_REGION,
1211
RUNNER_VERSION,
1312
SANDBOX_EXTRA_ENV,
@@ -109,12 +108,10 @@ def build_runner_image() -> modal.Image:
109108
# Pre-built image instance for reuse
110109
runner_image = build_runner_image()
111110

112-
# Sandbox entrypoint — unified dockerd + runner in a single command chain.
113-
# dockerd starts in background. The dockerd wait + image load are also backgrounded,
114-
# so the runner starts IMMEDIATELY without waiting for dockerd.
111+
# Sandbox entrypoint — starts dockerd in background and immediately launches the runner.
112+
# The dockerd wait + image load run in the background so the runner starts without delay.
115113
# Non-Docker jobs skip the 60s dockerd startup entirely.
116-
# After the runner exits, sleep infinity keeps the sandbox alive.
117-
# idle_timeout terminates the sandbox after a period of inactivity.
114+
# After the runner exits, the entrypoint ends and the sandbox terminates normally.
118115
SANDBOX_CMD = (
119116
"bash -c '/start-dockerd.sh &'"
120117
" && (for i in $(seq 1 60); do docker info > /dev/null 2>&1 && break; sleep 1; done;"
@@ -123,7 +120,6 @@ def build_runner_image() -> modal.Image:
123120
" && export RUNNER_ALLOW_RUNASROOT=1"
124121
" && export DOCKER_BUILDKIT=1"
125122
" && ./run.sh --jitconfig \"$GHA_JIT_CONFIG\" 2>&1 | tee /tmp/runner.log"
126-
" && sleep infinity"
127123
)
128124

129125

@@ -151,8 +147,6 @@ async def spawn_sandbox(
151147
volumes=sandbox_volumes,
152148
experimental_options={"enable_docker": True},
153149
)
154-
if IDLE_TIMEOUT_SECONDS > 0:
155-
sandbox_kwargs["idle_timeout"] = IDLE_TIMEOUT_SECONDS
156150
if MODAL_REGION:
157151
sandbox_kwargs["region"] = MODAL_REGION
158152

0 commit comments

Comments
 (0)