u/Beginning_Brush_6770

▲ 5 r/golang

Architecture advice: Managing timeouts and zombie containers in a Go worker pool evaluating untrusted code

Hey gophers,

I’m building an evaluation engine (essentially an online judge) that compiles and simulates user-submitted hardware design code. The worker pool is written in Go, and it spins up ephemeral Docker containers via the Docker Go SDK to sandbox the execution environment and run synthesis tools.

The challenge is safely evaluating untrusted code that might contain infinite loops, fork bombs, or massive memory allocations, while ensuring the Go worker pool stays resilient and doesn't leak resources.

My current approach:

  1. Receive job from the queue (Redis/RabbitMQ).
  2. Spin up a container with strict CPU and memory limits applied via HostConfig.
  3. Drop all network privileges (NetworkMode: "none") and mount a read-only filesystem, except for a temporary volume for the specific job.
  4. Wrap the execution in a context.WithTimeout (e.g., 5 seconds) passed to ContainerWait and ContainerLogs.
  5. If the context deadline exceeds, aggressively call ContainerKill and clean up.

My concerns where I'd love some battle-tested advice:

  • Zombie Containers: If a Go worker panics or the host machine hard-crashes mid-execution before the deferred ContainerRemove fires, orphaned containers are left spinning. Do you typically handle this with a separate reaper service/cron job, or is there a cleaner pattern within Go?
  • Context Cancellation Edge Cases: Are there known pitfalls in the Docker Go SDK where streaming logs (ContainerLogs) from a hijacked container could block a goroutine indefinitely, even when the parent context is cancelled?
  • The Next Level: At what scale or security threshold did you find Docker insufficient and migrate to raw containerd, runc, or microVMs like Firecracker?

Would love to hear war stories from anyone who has built CI runners, sandboxes, or remote code execution platforms in Go.

Thanks!

reddit.com
u/Beginning_Brush_6770 — 5 days ago

Mujii OS - Portfolio desguised as OS

Hey everyone! 👋

I'm an engineer who works a lot with hardware (Verilog, RISC-V) and software (Go, Vector Databases). I was incredibly bored of the standard, static scrolling resume websites.

I had this hyper-specific creative vision for my portfolio: I wanted a fully interactive, physics-based desktop environment with a cinematic ASCII boot sequence, a secure lock screen, and a unique "Pink Glassmorphism" aesthetic.

I knew exactly what I wanted it to look and feel like, but to execute it at the speed of thought, I partnered with Antigravity (an advanced agentic AI) to "vibe code" the architecture with me.

I acted as the creative director—demanding extremely specific things like Apple-style wave animations, custom Z-index stacking contexts for the windows, and hardware-accelerated Framer Motion spring physics—and the AI wrote the code alongside me to make it happen.

The result is Mujii OS.

I won't bore you with a massive feature list. I'll just let you log in and explore the draggable windows and orbital UI yourself.

Live Demo: https://github.com/mujii88/Mujii_OS

I've completely open-sourced the Next.js code under the MIT license. Feel free to explore the repo and see how we pulled off the window-manager physics! Let me know what you think of the vibe!

u/Beginning_Brush_6770 — 2 months ago