This service accepts source code and optional test/checker data over HTTP, executes the code in a temporary workspace copy, and returns the execution result. It is designed to be fast, stateless, and container-friendly.
Execute user code.
Request JSON:
timeout(optional string): Execution limit, e.g."30s". Defaults to 30 seconds.solution_text(string): Source code to run.lang_slug(string): Language identifier. Supported values:clojure,cpp,csharp,dart,elixir,golang,haskell,java,js,kotlin,php,python,ruby,rust,swift,ts,zig
asserts(optional string): JSON test data, stored asasserts.json.checker_text(optional string): Checker code. Required for:cpp,csharp,dart,java,golang,haskell,kotlin,rust,swift,zig
Response JSON:
exit_code(integer or null): Process exit code, if available.stdout(string): Captured standard output.stderr(string): Captured standard error.
Returns HTTP 200 when the service is ready.
Sets a shutdown flag and returns HTTP 200 when ALLOW_SHUTDOWN is enabled.
- Validate request parameters (reject non-identity content-encoding and oversized bodies).
- Create a temporary directory under
/tmpand copy the current workspace into it. - Write input files into a language-specific working directory:
solution_text→ language-specific filename (e.g.solution.py,Solution.java).checker_text(if provided) → language-specific checker file.asserts(if provided) →asserts.json.
- Execute the test command resolved from
make -n testviash -cin the temp workspace. - Enforce timeout; on expiration, terminate the process group.
- Capture
stdoutandstderr; if either stream exceeds 1MB, return an error.
The service runs make test in its working directory. That directory is expected to contain language-specific runner logic. The service writes files into a subdirectory:
check/for most languageslib/for Dart
For each request, the service writes the solution and (if required) checker files into the language directory (check/ or lib/). It then runs make test, which is responsible for compiling/executing the solution and checker for that language.
Filename mapping and checker requirement:
clojure:solution.clj(no checker)cpp:solution.cpp+checker.cpp(checker required)csharp:Solution.cs+Checker.cs(checker required)dart:solution.dart+checker.dart(checker required)elixir:solution.exs(no checker)golang:solution.go+checker.go(checker required)haskell:Solution.hs+Checker.hs(checker required)java:Solution.java+Checker.java(checker required)js:solution.js(no checker)kotlin:solution.kt+checker.kt(checker required)php:solution.php(no checker)python:solution.py(no checker)ruby:solution.rb(no checker)rust:solution.rs+checker.rs(checker required)swift:solution.swift+checker.swift(checker required)zig:solution.zig+checker.zig(checker required)ts:solution.js(no checker)
Environment variables:
PORT(default4040): Listener port.ALLOW_SHUTDOWN(defaultfalse): Enable the/shutdownendpoint when set to1ortrue.RUN_CONCURRENCY(default10): Max concurrent/runhandlers; requests return 429 when busy.RUN_INPUT_MAX(default1048576bytes): Max request body size.RUN_OUTPUT_MAX(default1048576bytes): Max bytes allowed per stream (0 disables the limit).DEBUG(defaultfalse): Enable request header logging; empty value enables it too.
timeout accepts a string with units: ms, s, or m (defaults to 30s when omitted).
- Request body limit:
RUN_INPUT_MAX(HTTP 413 on overflow). - Output limit:
RUN_OUTPUT_MAXper stream (HTTP 413 when exceeded).
- The execution occurs in a temporary directory under
/tmpbuilt by copying the current workspace. - The service runs commands in a separate process group for reliable termination.
- On Linux, each run is executed in new namespaces (PID, mount, IPC, UTS, NET) and drops to UID/GID 10001.
- Network is disabled by placing the run in a new network namespace with no interfaces.
- Resource limits (rlimits) are applied in the sandboxed child:
RLIMIT_CPU: equals the request timeout (rounded up to whole seconds).RLIMIT_NOFILE: 256 open files.RLIMIT_NPROC: 256 processes/threads.RLIMIT_CORE: 0 (no core dumps).
- Rationale for
256limits: high enough for typical compilers/builds while preventing FD/process exhaustion; these can be tuned in code if needed.
- The service is stateless; each request creates a fresh temp workspace and cleans it up after execution.