Repository navigation
Running in production
New in 0.5.4. This page is also in the repository as docs/operations.md; the fields are listed with the rest of /stats on Stats and monitoring, and the two keys under Configuration.
holyWisp is one process with one event loop per worker thread. The workers share the security
state: reputation, the rate-limit windows (conn_rate, per_source, per_dest_*) and the
server-queue-max budget. So a limit set in the config holds for the whole relay. Run it as
several processes and each limit becomes that many times looser than what was configured. The
cost of threads is that one worker's crash ends the process. This page covers what makes that
manageable: seeing each worker, knowing when one is stuck, a crash report that says where, and
restarts that do not drop every tunnel.
Every GET /stats describes the whole process, whichever worker answers it. Each worker reads
every other worker's atomics, so one poll is enough and no admin port is needed per worker.
| Field | Meaning | Alarm on |
|---|---|---|
workers[i].loopAgeMs |
Milliseconds since worker i's loop last ran its heartbeat, a timer that comes due every 500 ms. A busy worker is still on time: the timer runs whenever the loop gets back to its timers. A worker stuck in one callback stops it, and its age grows from then on. | above 5 000 |
liveness.workerLoopAgeMaxMs |
The stalest worker: the one number for a probe. | above 5 000 |
workers[i].loopLag |
A histogram (bucket bounds are timing.boundsMs) of how late each heartbeat ran, which is how long the loop was busy with something else first. A worker that stalls for 200 ms now and then shows up here before it shows up in an age. |
counts in the 100 ms buckets and above |
liveness.maintenanceAgeMs |
The maintenance thread (evictions, reputation saves, WARP and policy reloads) comes round once a second. | above 5 000 |
workers[i].queuedBytes |
What the worker's connections hold queued, toward their clients and toward their remotes. The server-wide budget bounds the sum. | close to memory.serverQueueMax
|
workers[i].connections, .streams
|
What the worker holds. A new connection goes to the worker with the fewest, so these stay level. | one worker far from the rest |
memory.cgroupBytes, .cgroupMaxBytes
|
What the process's cgroup is charged, kernel socket buffers and pipes included, and its memory.max (Linux, cgroup v2). Under systemd this is the unit's own cgroup. Run from a shell, it is the login session's. |
cgroupBytes above 80% of cgroupMaxBytes
|
drain |
Whether a drain is under way and how long it has left. |
state is running, then draining and drained during a drain, and stopped once the loop
has ended. A worker whose loop failed takes the whole server down with it. The process then
exits non-zero, so a service manager restarts it. It is never left half-alive, with a listener
that takes connections nobody serves.
With worker-watchdog-s = N, the maintenance thread looks at every worker's heartbeat once a
second. When one is N seconds old, the thread logs which worker it is and how long it has been
stuck, then sends that thread SIGABRT. The crash report below is therefore the stuck thread's own:
its frames show the call it is stuck in. If the thread cannot take the signal within 3 s (it is
stuck inside the kernel), the process aborts anyway. Either way the exit is a crash, and
Restart=on-failure starts the server again. This covers the case Restart= alone cannot, a
process that is alive but wedged, without an external check.
No loop is supposed to block: DNS, password hashing and reading files all happen on threads of their own. So a heartbeat that is seconds late is a bug, and the packaged config sets 60. The minimum is 2.
The holywisp binary installs handlers for SIGSEGV, SIGBUS, SIGFPE, SIGILL and SIGABRT. Every
thread is named (hw-worker-3, hw-maint, hw-resolver, hw-auth, and so on), and the names
show up in top -H, ps -L, gdb and perf as well. Each worker thread has an alternate signal
stack, so a stack overflow gets a report too. A report is a few log lines:
2026-11-23T02:50:22.270Z [error] crash: holywisp 0.5.4: SIGSEGV (code 1) at 0x0, a null pointer or one near it on thread hw-worker-3 (tid 4242, pid 4239)
2026-11-23T02:50:22.270Z [error] crash: #0 0x5cc008cfb485 /usr/bin/holywisp+0x6a485
...
2026-11-23T02:50:22.270Z [error] crash: frames by name: addr2line -Cfipe /usr/bin/holywisp 0x6a485 0xf92a ...
The first line tells apart the cases that matter:
-
a null pointer or one near it: an address in the first 64 KiB. -
at this thread's stack guard: the stack ran over: the fault is at the thread's guard page. - Any other address: a bad pointer.
-
sent by pid N: the signal was sent rather than raised by a fault.(this process)means the watchdog sent it; pid 1 means systemd did.
Run the addr2line line on the same binary to turn the frames into function names. The packaged
binary keeps its symbol table, so the functions resolve. Source lines need a build with -g.
After the report, the signal's default action ends the process, so the exit status and a core
dump (where enabled) are those of an ordinary crash. Threads are not restarted: a thread that
crashed may hold locks or half-made state, so a clean process start is the only safe recovery.
A signal that already has a handler when the server starts keeps it. Under the sanitizer build
(make build), ASan reports SIGSEGV and the others in its own words.
Frames come from glibc's backtrace(). A static musl binary (the npm package's Linux builds)
reports the signal and the thread but no frames, and says so. macOS and Windows have no report.
There the system's crash reporter or a debugger does the job.
With drain-timeout-s = N, the first SIGTERM or SIGINT starts a drain:
- Every worker closes its listener at once. It first accepts whatever the kernel had already queued on it, since closing would reset those connections. New WebTransport handshakes are turned away.
- A connection with no stream open is closed (WebSocket 1001, or the WebTransport session's close) once its client has been quiet for a second. It holds nothing a close would lose, and its client reconnects on its next request.
- A connection with streams open goes on as before: its streams keep relaying, and it may open new ones. A page halfway through loading finishes loading.
- When no connection is left, the server stops. At N seconds, whatever is still open is closed and the server stops. A second SIGTERM or SIGINT stops it at once.
With 0 (the default), a stop is immediate, as before.
The listener is closed for the whole drain. Clients that connect during the drain are refused until a server is listening on the port again. How long that gap lasts depends on how you restart:
-
systemctl restart holywispwaits for the old process to exit before it starts the new one. New clients are refused for up to N seconds, and no open tunnel is dropped. Keep the unit'sTimeoutStopSec(90 s by default) above N, or systemd kills the drain with SIGKILL. -
Two units on one port, for no gap at all: run the new server as a second unit while the old one drains. Make a template unit for this by copying
holywisp.serviceto/etc/systemd/system/holywisp@.service; the packages do not ship one. The old server closes its listener at once, so the new one can bind the port right away. The server refuses to share a port with a process that is still listening, so start the new unit just after signalling the old one, not before:systemctl kill -s TERM holywisp@blue # drains: its listener is closed within milliseconds systemctl start holywisp@green # binds the port the old one let go
While both run, each enforces its own limits and keeps its own reputation table, and both write the reputation store. The process that exits last writes the store last.
-
nginx in front, with a single upstream, answers 502 to new upgrades while no server listens. With the two-unit pattern there is no such window.
The packaged unit caps the service at MemoryMax=1G. When a cgroup cap is reached, the kernel's
OOM killer ends the process, every client with it, and to the field that looks like a holyWisp
crash. The queue budget exists so that does not happen: past server-queue-max, a connection
that would queue more is paused, never closed. So at start the server reads the tightest
memory.max over its cgroup, holds server-queue-max to half of it, and logs that it did. The
other half is for memory the budget does not count:
| What | Bounded by | Counted by the budget |
|---|---|---|
| Frames queued toward a client, and the bytes of its streams queued toward their remotes |
ws-write-high-water (the client is no longer read from at twice it), stream-queue-max, conn-queue-max
|
yes, in whole MiB per connection: a connection queueing under 1 MiB is not counted |
| A connection's read buffer | 256 KiB, more for a client that sends large messages (two of its packets) | no |
| Client sockets' kernel receive buffers |
client-recv-buffer (8 MiB) where rmem_max allows it. Filled only while the server is not reading that client |
no |
| Remote sockets' kernel buffers | the kernel's TCP autotuning (tcp_rmem, tcp_wmem) |
no |
| Relay pipes | 1 MiB each, one per busy bulk download (relayPipes) |
no |
These are bounds taken from the configuration, not measurements. Measure on your own traffic
instead: at peak, read memory.cgroupBytes together with the sum of workers[].queuedBytes
and workers[].streams. Bytes per stream at peak, multiplied by the most streams you want to
carry, is the size to plan for. Set MemoryMax well above that (sudo systemctl edit holywisp,
[Service], MemoryMax=8G), and raise server-queue-max to at most half of MemoryMax, so
that when the queues grow the budget pauses clients before the kernel kills the process.
Checked against commit db9d9e8 on master of Fracital/holyWisp. Where a page and the code disagree, the code is right.
Getting started
Running a server
- Configuration
- Reverse proxy
- Security and limits
- Stats and monitoring
- Running in production
- Troubleshooting
Features
Clients
Releases