Repository navigation
Troubleshooting
Symptoms, what causes them, and what to change. Status lines, bodies and log lines on this page are what the server and holywisp-client print, copied from real runs.
Most answers start in the log. The default level is info. Raise it while the server runs, without dropping anyone:
sudo systemctl kill -s USR1 holywisp # one level more verbose (info -> debug)
sudo systemctl kill -s USR2 holywisp # one level less
journalctl -u holywisp -fAt debug every connection logs its peer and the client address it resolved to, and every stream logs why it closed:
[debug] conn: 127.0.0.1:36392 (203.0.113.7): websocket wisp-v1
[info] egress: 127.0.0.1: blocked localhost:22 (loopback)
[debug] stream: 127.0.0.1:52910: stream 1: resolve nonexistent.invalid: Name or service not known
[debug] stream: 127.0.0.1:52910: stream 1 closed: unreachable host
GET /stats counts refusals and stream ends by cause (see Stats and monitoring). holywisp-client -v prints the close reason of each stream it opens.
| Status and body | Cause | Fix |
|---|---|---|
200 with the page or holyWisp: a Wisp server. Connect with a WebSocket client.
|
The request reached the server without Upgrade: websocket and Connection: upgrade, so it is a plain request. A browser reports an unexpected response code 200. |
Forward the upgrade headers. In nginx, proxy_http_version 1.1 and proxy_set_header Upgrade / Connection (see Reverse proxy). |
426 websocket upgrade required |
Same as above, with non-ws-response empty. |
Same. |
426 wisp-v2 with authentication required |
password-required is on and the client did not offer a Sec-WebSocket-Protocol, so it would be Wisp v1, which has no login. |
Use a v2 client with a password, or turn password-required off. |
400 bad request |
The head is over 8192 bytes, has more than 48 headers, a header name that is not a token, a folded line, or a NUL or bare CR in a value. | Find what adds headers (a CDN and a proxy each add several). |
400 forwarding header too long |
A trusted proxy sent a forwarding header over 511 bytes. The cut end is where the proxy wrote the address, so the client cannot be known. | Have the proxy overwrite the header (proxy_set_header X-Forwarded-For $remote_addr) instead of appending to the client's value. |
403 origin not allowed |
allow-origin is set and the page's Origin is not on it. Matching is whole scheme://host[:port], without case. |
Add the origin, with its port if it has one. A request without Origin is never refused for this. |
403 blocked |
The client's reputation score reached the strict tier (81 by default). | Wait for decay (reputation-decay-per-hour), or see Security and limits for the events that raised it. |
429 rate limit, Retry-After: <connection-window-s>
|
More than connections-limit-per-ip new connections (200) in connection-window-s (10 s) from one address. |
If many clients share one address, see below. |
429 too many connections |
More than max-concurrent-connections-per-ip (5000) open from one address. |
As above. |
429 with an empty body, before anything was read |
More than max-handshakes-per-ip (128) connections from one peer still sending their HTTP head. Trusted proxies are exempt. |
List the proxy in trusted-proxy. |
503 at capacity |
max-concurrent-connections (50000) are open. |
Raise it, or add servers. |
holywisp-client shows the start of the answer:
bad upgrade response: HTTP/1.1 429 Too Many Requests\x0d\x0aContent-Type: text/plain; charse
Behind the npm package's route(), three answers come from the wrapper rather than the server: 503 while the server is not running (between a crash and its restart, too), 502 when it does not answer, and 403 for a socket whose peer address does not parse (Node package).
If the proxy is not in trusted-proxy, every client has the proxy's address, and the per-address limits above are shared by all of them. The debug line shows it: the address in parentheses is the proxy's (127.0.0.1:36392 (127.0.0.1)). Add trusted-proxy = 127.0.0.1 (and ::1 if the proxy connects over IPv6). With trusted-proxy-secret set, a proxy that does not send X-HolyWisp-Proxy-Secret has the same effect.
| What the client sees | Cause |
|---|---|
Wisp CLOSE 0x04 on stream 0 |
The client's INFO does not parse or has another major version. |
Wisp CLOSE 0xc0 on stream 0 |
Wrong password. The log says auth: <peer>: bad password and never the user name. |
Wisp CLOSE 0xc2 on stream 0 |
password-required is on and the client sent no password. |
Wisp CLOSE 0x49 on stream 0 right after INFO |
64 hashed-password checks were already queued. The client was turned away, not scored. |
WebSocket close 1002, 1003 or 1009
|
The client sent an unmasked frame or reserved bits (1002), a text frame (1003), or a message over max-message-size (1009). |
WebSocket close 1001
|
idle-timeout-s is set, and the connection had no streams and sent nothing for that long. |
| The connection drops after about 60 s of quiet | A proxy's idle timeout. holyWisp sends no WebSocket pings of its own. Raise proxy_read_timeout in nginx. |
| The connection drops when the client stops reading | Past twice ws-write-high-water the server stops reading from that client; after client-write-timeout-s (120 s) without progress it closes it. |
A stream refused or ended by the server gets a CLOSE with one of these reasons. holywisp-client -v prints them like this:
connected: wisp-v1, window 128, 1 lane, stream credit 0, upload credit 0, stream limit 0
[stream 1] CLOSE host blocked (0x48)
| Reason | Meaning | Common causes |
|---|---|---|
0x41 invalid stream info |
The CONNECT itself is wrong. | An empty host, port 0, a host over 255 bytes (a terminal command over 4096), a byte outside A-Z a-z 0-9 . _ : [ ] -, a name whose last label is a number (1.2.3, 2130706433), an unknown stream type, or a CONNECT for an id already open (that stream is closed too). |
0x42 unreachable host |
No address to dial. | DNS failed or timed out (dns-timeout-ms), every address was unreachable, a UDP port answered "port unreachable", an upstream proxy reported the host unreachable, or tcp-warp-fallback/udp-warp-fallback refuse found no tunnel. |
0x43 no response |
The dial did not finish. | No answer within connect-timeout-ms (15000), or the upstream proxy's handshake did not finish in that time. |
0x44 connection refused |
The remote answered with a reset. | Nothing listens on that port. |
0x47 transfer timeout |
An open stream's remote stopped answering. | TCP keepalive went unanswered (first probe after 60 s idle, then 4 probes 15 s apart), or retransmissions timed out. |
0x48 host blocked |
Policy refused it. | A private, loopback or other non-public address (below); a literal IP without allow-direct-ip; allow-host/block-host/allow-port/block-port; allow-tcp or allow-udp off; UDP with a proxy and no proxy-udp = direct; a terminal stream with Twisp off or the client not logged in; a destination with strict reputation; the upstream proxy refused the login. |
0x49 throttled |
A limit was hit. | More open streams than max-streams-per-conn (2048, or 16 for a client in the throttle tier); more than max-connects-per-source-per-second (500) CONNECTs, terminal streams included; a destination's max-connects-per-dest-per-second (100) or -per-minute (3000); the in-flight SYN caps; max-pending-lookups-per-ip (128) lookups; a remote that does not take what the client sends past stream-queue-max. |
A destination limit that many clients share (the per-destination windows, max-in-flight-syns) closes the stream 0x49 without holding it against the client. The client's own caps, such as max-in-flight-syns-per-ip, count as a violation, and ws-close-after-violations (64) of those close the connection.
By default a stream may reach public unicast addresses only. Loopback, RFC 1918, CGNAT (100.64.0.0/10), link-local, multicast, broadcast and reserved ranges are refused with 0x48, and IPv4 wrapped in IPv6 is judged as the IPv4 inside. The check runs on each resolved address, so a name that resolves to 127.0.0.1 is refused like the literal, and a name with one public and one private address connects to the public one only. The log says which:
[info] egress: 127.0.0.1: blocked localhost:22 (loopback)
[info] egress: 127.0.0.1: blocked direct IP 127.0.0.1:22
To allow a class, set its key: allow-loopback, allow-private (RFC 1918, CGNAT, fc00::/7) or allow-link-local. A literal address in the CONNECT also needs allow-direct-ip. Multicast, unspecified and reserved ranges have no switch.
Each of these opens that part of the network to every client of the relay. On a public relay, reach an internal host through an upstream proxy with its own policy instead (Proxies and WARP). Asking for a private address is counted (blocked.egress in /stats) but has no reputation weight by default, since any web page can make a visitor's browser ask.
holywisp-client with a pin that does not match:
TLS handshake failed (alert 42): the certificate may not match the pin
Take the current value from /webtransport.json on the TCP port. It lists the current and the previous self-signed certificate; the server makes a new one every 6 days.
Chrome reports a failed session as WebTransportError with "Opening handshake failed.". Things to check, in order:
- The UDP listener is reachable. It binds
webtransport-host, which defaults tohost; with the packagedhost = 127.0.0.1it listens on loopback only. The firewall must pass UDP onwebtransport-port. - The page dials the right port. With no
webtransport-url, the page dials the relay's own host and port over HTTPS: behind a proxy on 443 that is UDP 443. Setwebtransport-port = 443orwebtransport-url. - The certificate is one the browser takes. A pinned self-signed one must be ECDSA P-256 and valid for at most 14 days, which the rotating one is. An operator certificate (
webtransport-cert,webtransport-cert-dir) is checked through the Web PKI, so it must be trusted and name the host;/webtransport.jsonthen lists no hashes. - The session was admitted. A path no
webtransport-pathrule names is a404, logged atdebugassession for a path no webtransport-path names. The origin list and a STRICT reputation answer403, the per-IP connect rate and connection cap429,max-concurrent-connections(or a failed allocation)503, and a v1 session withpassword-required426, as on the WebSocket. The HTTP/3 layer answers405to a CONNECT for another protocol and429to a second session on one QUIC connection (WebTransport).
curl --http3-only https://<host>:<port>/ answering 421 is expected. Only an extended CONNECT is WebTransport, and every other HTTP/3 request gets 421 with alt-svc: clear.
At start the server warns when the kernel grants a smaller UDP buffer than it asked for (4 MiB):
UDP receive buffer is <n> bytes, not the 4194304 asked for (net.core.rmem_max): a full one drops datagrams, and QUIC then slows the session down
Raise net.core.rmem_max and net.core.wmem_max to at least 4 MiB.
More on certificates and paths is on WebTransport.
That is how Chrome reports a session that ended without a close it understood. Causes on the server side:
- The server process died without a stop (a crash, SIGKILL, the OOM killer). A clean stop sends every session a close capsule and then QUIC's CONNECTION_CLOSE. After a crash, the next process can end the old sessions with a stateless reset only if it has the same reset key: set
webtransport-reset-key-file, or clients wait outwebtransport-idle-timeout-s(30 s). - A NAT or firewall forgot the UDP flow. The server sends a keepalive after 20 s without sending, for a conntrack table that keeps a flow for 30 s. A shorter timeout on the path still drops quiet sessions.
- The client stopped sending and the idle timeout passed.
Work from the outside in:
- The reverse proxy. nginx relays an upgraded connection through
proxy_buffer_size, 4 or 8 KiB by default, which held one connection to about 400 to 500 MiB/s on a test host against about 2,000 MiB/s with256k. See Reverse proxy. - The host's TCP. On a long path a stock kernel (cubic, a 4 MiB
net.ipv4.tcp_wmemmaximum) is the limit: on an emulated 40 ms path one download did 89 MiB/s that way and 530 MiB/s with BBR and 32 MiB buffers. Setnet.ipv4.tcp_congestion_control = bbrand raisenet.core.wmem_max,net.core.rmem_max,net.ipv4.tcp_wmemandnet.ipv4.tcp_rmem. - Per-client limits.
bandwidth-limit-kbpscaps each address in both directions (0, off, by default). A client in the reputation throttle tier gets 16 streams at most. - Upload windows. A client may have
upload-windowbytes in flight toward its remotes across all its streams (0 meansws-write-high-water, 8 MiB). Upload speed is at most that window over the round trip: 8 MiB at 80 ms is about 100 MiB/s. The CONTINUE window isbuffer-remaining(128) packets, capped so a full window ofmax-message-sizepackets fits instream-queue-max; the log says so at start when the cap applies (buffer-remaining 128 capped to ...). - The client receive buffer. Client sockets get
client-recv-buffer(8 MiB) only whennet.core.rmem_maxgrants at least 4 MiB. The server asks the kernel at start, which works under the unit'sProcSubset=pidtoo. Otherwise the start log saysclient-recv-buffer not applied: the kernel grants <n> bytes for 8388608 (rmem_max), under 4194304, and when the grant is enough but less than asked,client-recv-buffer 8388608 capped to <n> bytes by the kernel (rmem_max). - Download windows. A v2 client that asks for stream credit (
0xE2) sets each stream's window itself, and a small one holds the stream to window over round trip.holywisp-client --creditshows the effect. - An upstream proxy. Every TCP byte through a
proxygoes through that process too.
Client and benchmarks has the --bench commands to measure each step.
[warn] accept: worker 0: out of file descriptors, not accepting
Each client is one descriptor, each open stream one more, and a busy bulk download two more for its relay pipe. When accept fails with EMFILE or ENFILE, the worker stops accepting for 100 ms and tries again; the warning repeats at most every 5 s. The packaged unit sets LimitNOFILE=262144. A server started by hand inherits the shell's limit, often 1024: raise it with ulimit -n first. nginx in front needs two descriptors per client too (worker_rlimit_nofile).
max-handshakes-per-ip (128) and handshake-timeout-ms (10000) bound how many descriptors one address can hold with connections that never finish their HTTP head.
On Linux a bulk TCP download is relayed with splice through a pipe of its own, without a copy. The kernel charges pipe memory per user, and past fs.pipe-user-pages-soft (16384 pages, 64 MiB, on a stock kernel) it hands out 8 KiB pipes. holyWisp asks for 1 MiB pipes and takes nothing under 256 KiB; when it is refused, that stream copies instead, and the worker waits 2 s before asking again. At debug:
worker 0: no relay pipe of 262144 bytes (No buffer space available); copying
relayPipes in /stats counts the pipes open now. Copying is correct and a little more expensive per byte. To let more streams splice, raise fs.pipe-user-pages-soft, for example to 262144 (1 GiB of pipes for the wisp user). Other processes of the same user count against the same limit.
Check a file before a restart. --check-config parses it as a start would, binds nothing, prints no secret, and exits 0 or 1:
holywisp --config /etc/holywisp/holywisp.conf --check-configholywisp 0.5.4: configuration ok
Messages from real runs:
holywisp: unknown option 'no-such-key'
holywisp: bad.conf:2: bad value 'maybe' for 'allow-loopback'
holywisp: bad value '70000' for 'port'
holywisp: configuration refused: enable-twisp needs enable-v2
holywisp: configuration refused: enable-twisp needs password auth: add a password-user
holywisp: configuration refused: connections-limit-per-ip and connection-window-s must both be set or both be zero
holywisp: configuration refused: webclient-wisp-url must start with ws:// or wss://
holywisp: configuration refused: webtransport-cert /nonexistent.pem: No such file or directory
holywisp: configuration refused: proxy: missing host
holywisp: configuration refused: policy-file: /etc/holywisp/policy.conf: No such file or directory
holywisp: /etc/holywisp/holywisp.conf:40: dns-server: 'dns.google' is not an IP address with an optional port (1.1.1.1, 1.1.1.1:53, [2606:4700:4700::1111]:53)
holywisp: /etc/holywisp/holywisp.conf:12: line longer than 1023 bytes
The value of proxy, trusted-proxy-secret, proxy-client-key-secret, a webtransport-path or a password-user never appears in a message. A line may hold 1023 bytes, comments included; a dns-server is an IP address (IPv6 in brackets) with an optional port. Booleans are on/off, true/false, yes/no or 1/0. An unknown option from the npm package's server usually means binary points at a build older than the wrapper. Every key is on Configuration.
There is no reload. systemctl reload holywisp is refused because the unit has no ExecReload, and the server has no SIGHUP handler, so a HUP stops it. A config change takes systemctl restart holywisp.
Another program on the port, another holywisp included:
holywisp: cannot start: Address already in use
The workers' listeners share the port with SO_REUSEPORT, but the server binds it once without that flag first, so a port that any socket holds is refused, even by a holywisp of the same user. With webtransport on, a taken UDP port shows as:
[error] wt: cannot bind UDP 127.0.0.1:6001 for WebTransport: Address already in use
holywisp: cannot start: Invalid argument
Find the holder and stop the one you did not mean to run:
ss -ltnp 'sport = :6001' # TCP
ss -lunp 'sport = :6001' # UDP, for WebTransportThe packaged unit caps the process at MemoryMax=1G. The packaged config keeps server-queue-max at 512 MiB under it, but a config that raises the budget toward the cap, or one copied from elsewhere with the binary's 4 GiB default, lets the kernel end the process inside its cgroup (the journal shows an oom-kill for holywisp.service) before the budget pauses anyone, and systemd restarts it after 2 s. Keep server-queue-max at about half of MemoryMax, or raise both with sudo systemctl edit holywisp.
Since 0.5.4 the server holds the budget to half of the cap itself, and says so at start when it lowers it (server-queue-max 4096 MiB capped to 512 MiB: half of this cgroup's memory.max (1024 MiB), ...), so a kill comes only from memory the budget does not count. memory.cgroupBytes in /stats shows the charge; see Running in production for sizing.
From 0.5.4 a crash on Linux leaves a report in the journal (journalctl -u holywisp), a few lines starting crash:. The first names the signal, the thread (hw-worker-3, hw-maint, hw-resolver, ...) and what the address looks like: a null pointer or one near it, at this thread's stack guard: the stack ran over, any other address (a bad pointer), or sent by pid N (another process sent it; (this process) is the watchdog). The last line is an addr2line command: run it on the same binary to name the functions. Running in production has an example. Include the whole report in an issue. A static musl build (the npm package on Linux) reports no frames; macOS and Windows have no report.
Some clients hang while others, and /health, still work: one worker's loop is blocked, and the clients on it wait. /stats shows it: that worker's loopAgeMs grows and liveness.workerLoopAgeMaxMs with it. With worker-watchdog-s set (60 in the packaged config) the process ends with that thread's crash report and systemd restarts it; without, restart it yourself and report it, since no loop is meant to block.
Both are development ports. On Windows a config with enable-twisp or a $ hashed password is refused at start, and the server stops when its stdin closes (stop-on-stdin-eof) instead of on SIGTERM. On macOS a $5$, $6$, $y$ or $2b$ hashed password is refused at start, because the system crypt(3) knows only DES: use a plain password there. Both copy bulk downloads where Linux splices, so do not benchmark or deploy on them. The full comparison is under Platforms on Install and run.
Not on the TCP port. Terminate wss:// at nginx, Caddy or a CDN. TLS 1.3 exists in-tree only for the WebTransport listener, because nothing can terminate QUIC in front of the server and hand it Wisp.
No. The browser connects to holyWisp's UDP listener directly (Reverse proxy).
No. The server takes a WebSocket upgrade on any path. A path in front is the proxy's business.
The plain paths (/health, /stats, /webtransport.json, /) match alone or followed by a query string, so /health?x=1 is the health answer, but another path such as /healthz or /health/ gets the banner.
The proxy in front is not in trusted-proxy. See Every client gets 429 behind a proxy.
The name resolved to a private or loopback address, or every address it resolved to was refused. The egress log line names the class.
It is on the same port as the relay, so anyone who reaches the relay can read it. Restrict it at the proxy (Reverse proxy).
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