$ show DMOJ/judge-server
The DMOJ judge-server is the core judging component of the DMOJ (Modern Online Judge) platform, responsible for executing and evaluating programming contest submissions in sandboxed environments. It features a plugin-based architecture supporting over 50 programming languages through language-specific executors, graders, and checkers. The system handles secure sandboxing via ptrace and seccomp (Linux) or ptrace (FreeBSD), manages problem configurations with automatic reloading, and communicates with the judge server using a custom packet protocol. Key entry points include the main judge daemon (dmoj), a CLI tool for local testing (dmoj-cli), and an autoconfiguration utility for runtime detection. The codebase demonstrates strong separation of concerns, with isolated components for sandboxing, subprocess communication, and output normalization that exhibit reusable patterns.
The LLM identified 3 files worth highlighting for reuse:
Implements a layered sandboxing system using seccomp for syscall filtering and hierarchical filesystem policies. Isolates untrusted code by restricting system calls and file access. Demonstrates non-obvious skill in secure process isolation and is decoupled from the rest of the judge system.
Provides PopenCommunicator and PopenCommunicatorWS classes for safely communicating with subprocesses, enforcing time and memory limits, and capturing output. Isolated from the rest of the system and reusable in any project needing controlled subprocess execution.
Implements functions to normalize output by removing trailing spaces, collapsing consecutive blank lines, and handling end-of-line differences. Essential for flexible output comparison in programming contests and demonstrates a clean, reusable solution to a common problem.