Skip to content

Commit 3ad7fe1

Browse files
feat: add security_opt support for execution client containers (#9)
* feat: add security_opt support for execution client containers Add a `security_opt` field to the scenario config that gets passed to Docker's `containers.run()`. This allows setting Docker security options like `seccomp=unconfined` which is needed for profiling tools (e.g., perf/perfcollect) to call `perf_event_open` inside containers. Example usage in scenario config: ```yaml security_opt: - seccomp=unconfined ``` * feat: add 30s grace period before stopping execution client * fix: remove redundant inline import - time already imported at top * fix: increase stop timeout to 60s instead of pre-stop sleep WritePGOData only flushes on process exit (SIGTERM handler), not while idle. The 30s sleep before stop was pointless - Nethermind just sits waiting for blocks. Instead increase Docker's SIGTERM-to-SIGKILL timeout from 10s to 60s so the shutdown handler has time to flush. * fix: rename security_opt to execution_client_security_opt for consistency * fix: increase stop timeout to 120s for RocksDB flush + PGO data write --------- Co-authored-by: Carlos Bermudez Porto <cbermudez.dev@gmail.com>
1 parent b8f6ba7 commit 3ad7fe1

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/expb/configs/scenarios.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ class Scenario(BaseModel):
161161
description="Extra commands to run in the execution client docker container during the test execution.",
162162
default=[],
163163
)
164+
security_opt: list[str] = Field(
165+
description="Docker security options for the execution client container (e.g., seccomp=unconfined).",
166+
default=[],
167+
)
164168

165169
@field_validator("client", mode="before")
166170
@classmethod

src/expb/payloads/executor/executor.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ def start_execution_client(
426426
run_kwargs["cpuset_cpus"] = self.config.resources.cpuset
427427
if self.config.resources and self.config.resources.mem_swappiness is not None:
428428
run_kwargs["mem_swappiness"] = self.config.resources.mem_swappiness
429+
if self.config.execution_client_security_opt:
430+
run_kwargs["security_opt"] = self.config.execution_client_security_opt
429431
container = self.config.docker_client.containers.run(**run_kwargs)
430432
return container
431433

@@ -1029,9 +1031,10 @@ def cleanup_scenario(
10291031
)
10301032
execution_client_container.reload()
10311033
execution_client_volumes = execution_client_container.attrs["Mounts"]
1032-
execution_client_container.stop(
1033-
timeout=60 if self._dottrace_active else 5
1034-
)
1034+
# Give execution client 120s after SIGTERM to flush data (e.g. PGO
1035+
# profiles via WritePGOData, RocksDB flush, and dotTrace snapshot
1036+
# writes) before Docker sends SIGKILL (default 10s)
1037+
execution_client_container.stop(timeout=120)
10351038
logs_file = (
10361039
self.config.outputs_dir
10371040
/ f"{self.config.get_execution_client_name()}.log"

src/expb/payloads/executor/executor_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(
6767
scenario.extra_volumes
6868
)
6969
self.execution_client_extra_commands = scenario.extra_commands
70+
self.execution_client_security_opt = scenario.security_opt
7071

7172
# Executor Additional Tooling config
7273
## Docker client

0 commit comments

Comments
 (0)