Add option SECCOMP_PROFILE for qlever start - #338
Conversation
New `[runtime]` option `SECCOMP_PROFILE` (also `qlever start --seccomp-profile`) that passes `--security-opt seccomp=<path>` to the container engine when starting the server. Default is none, so the engine's default profile applies as before. The path is made absolute (and `~` expanded). Motivation: the default Docker seccomp profile blocks the io_uring syscalls, so QLever falls back to synchronous vocabulary lookups with a startup warning. A profile that allows them lets the server use the io_uring path. Only the server needs this: the io_uring rings are created when a vocabulary is opened for reading, which the index builder never does.
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of concrete correctness/robustness issues (type annotation consistency and a brittle test assertion around shell-quoting) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds support for specifying a custom seccomp profile when starting the QLever server container, enabling io_uring syscalls when desired while keeping the default behavior unchanged when no profile is configured.
Changes:
- Introduces a new
[runtime]/CLI optionseccomp_profile(--seccomp-profile) forqlever start. - Extends container command generation to optionally add
--security-opt seccomp=<absolute-path>. - Adds/updates tests to cover the new argument plumbing and command rendering.
File summaries
| File | Description |
|---|---|
| test/qlever/test_containerize.py | Adds unit tests for Containerize.containerize_command seccomp option handling and ordering. |
| test/qlever/commands/test_start_other_methods.py | Updates expected relevant Qleverfile arguments to include seccomp_profile. |
| test/qlever/commands/test_start_execute.py | Ensures seccomp_profile is passed through to containerization in start execution tests. |
| src/qlever/qleverfile.py | Adds --seccomp-profile runtime argument definition and help text. |
| src/qlever/containerize.py | Adds optional seccomp profile support to generated container engine command. |
| src/qlever/commands/start.py | Wires args.seccomp_profile into container start command and includes it in relevant Qleverfile args. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| volumes: list[tuple[str, str]] = [], | ||
| ports: list[tuple[int, int]] = [], | ||
| working_directory: str | None = None, | ||
| use_bash: bool = True, | ||
| seccomp_profile: Optional[str] = None, | ||
| ) -> str: |
There was a problem hiding this comment.
Fixed in b17e994, now str | None like the other parameters in this module.
| cmd = _cmd(seccomp_profile="seccomp.json") | ||
| expected = os.path.join(os.getcwd(), "seccomp.json") | ||
| assert f" --security-opt seccomp={expected}" in cmd |
There was a problem hiding this comment.
Fixed in b17e994, the test now compares against the shlex-quoted path.
There was a problem hiding this comment.
🔵 Needs a closer look
The undefined Optional annotation causes the Ruff lint check to fail.
Review details
Suppressed comments (1)
src/qlever/containerize.py:44
Optionalis not imported anywhere in this module. Although postponed annotations hide this during normal calls, Ruff's enabled F821 check will reject the undefined name (and runtime annotation introspection would also fail). Please use the union syntax already used forworking_directoryabove.
seccomp_profile: Optional[str] = None,
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Balanced
SECCOMP_PROFILE option for the server containerSECCOMP_PROFILE for qlever start
The `Optional` annotation was an undefined name (the module has no `typing` import and uses the union syntax elsewhere), which made the ruff check fail. The test now compares against the `shlex`-quoted path, so it also passes when the working directory contains a space.
So far,
qlever startran the server container with the default seccomp profile of the container engine. The default profile of Docker blocks the io_uring syscalls, so a server started this way logsio_uring is compiled in but unavailable at runtimeand falls back to synchronouspreadfor vocabulary lookups.This change adds the option
SECCOMP_PROFILEin the[runtime]section of the Qleverfile (alsoqlever start --seccomp-profile), which is passed to the container engine as--security-opt seccomp=<path>. With a profile that additionally allowsio_uring_setup,io_uring_enter, andio_uring_register, the server uses the io_uring path. Without the option, nothing changes. Onlyqlever startgets the option, because the io_uring rings are created when a vocabulary is opened for reading, which the index builder never does.