# Troubleshooting

**Exit codes** (every command):

| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Startup or runtime failure; `-set-admin-password` on an unusable `prefs.XML`, or on a missing or foreign one while a server runs |
| 2 | Usage: unknown command, bad argument, unusable `-Dcrushbalance.prefs`, prefs directory missing |
| 3 | `-check-config` found an ERROR or FATAL, or the file is not a CrushBalance 27 file or does not exist |
| 4 | `-i` or `-r` failed, or not on Windows |
| 5 | Password rejected: too short or too long, the two entries differ, or no input |
| 6 | Another CrushBalance holds the prefs directory |

Safe mode is not an exit: the process stays up. On a Java older than 25 the JVM refuses to start (`UnsupportedClassVersionError`, exit 1).

**Symptoms:**

| Symptom | Cause and fix |
|---|---|
| Safe mode banner; no listener runs | `prefs.XML` cannot be used. The reason names the problem: `PREFS_PARSE` (not well-formed, with line and column), `PREFS_DOCTYPE`, `PREFS_ROOT`, `PREFS_TYPE`, `PREFS_UNTYPED_CHILDREN`, `PREFS_TOO_LARGE`, `PREFS_UNREADABLE`, `PREFS_VERSION_BAD` (marker missing or wrong, for example a CrushBalance 11 file copied back), `PREFS_NEWER` (written by a newer CrushBalance), `PREFS_SET_ASIDE_FAILED` (an old file could not be renamed). Run `-check-config`; restore a backup or fix the file ([Operating](Operating.md)) |
| "Unlicensed: listeners are stopped" | No valid registration. A CrushFTP 9 or 10 registration is refused (OLD_VERSION); use a CrushFTP 11 or newer Enterprise registration ([Registering](Registering.md)) |
| A listener in state `bind_error` | Its port cannot be bound: in use by another program or by an outgoing connection (reserve listener ports, [Capacity and tuning](Capacity-and-Tuning.md)), below 1024 without root or `CAP_NET_BIND_SERVICE`, or the `bind_ip` is not on this host. Retried every 5 s; logged in category `server` |
| A listener in state `no_endpoints` or `config_error` | No endpoint, or a configuration error (for example an unusable TLS keystore); see System › Configuration issues |
| Every client refused after adding a deny rule | The list has only deny rules (RULES_DENY_ONLY): a non-empty list denies everything it does not match. Add `allow *` as the last rule |
| CrushMFT shows the balancer's address for every client | The endpoint sends no PROXY header (`proxy_protocol=none`), or the CrushMFT port ignores it. Set both sides ([PROXY headers](PROXY-Headers.md)) |
| Connections hang with no banner, or clients get an error or stray bytes at the start | The PROXY settings differ: CrushMFT waits for a header the endpoint does not send, or reads a header it does not expect as data. Match the endpoint's `proxy_protocol` and the CrushMFT port flags |
| FTP data connections fail (550 on the control connection) while logins work | The passive data connection reaches CrushMFT without the client address: set `proxy_protocol_ftp_pasv=true` in CrushMFT and the same PROXY version on the passive endpoints as on the control endpoint; check the passive address (`server_ip`) and the `pasv_ports` ranges ([FTP with passive ranges](Template-FTP-Passive-Ranges.md)) |
| FTP data connections reset by the balancer | The passive range's endpoint is `disabled`, or a shared passive range has no pin for the client's address. Use one range per backend, and keep its endpoint `enabled` while that backend has FTP sessions |
| WebInterface users bounced back to the login page | The endpoints of the listener differ in PROXY (CrushMFT binds sessions to the client address); `sticky_ttl` shorter than CrushMFT's session idle time; or a backend went DOWN without CrushMFT session replication |
| "TLS certificate expiring" or "A TLS listener has a certificate problem" | Renew or fix the listener keystore ([Operating](Operating.md)); the notice links to the listener's TLS tab |
| "Secrets cannot be decrypted" | `crushbalance.key` was lost, replaced or is unreadable. Restore the original key file (CrushBalance notices it), or enter the passwords again |
| An endpoint fails with `BACKEND_TLS` (endpoint failures, `route` log lines) | The back-leg TLS handshake failed: the certificate is not trusted, does not match the host name (without a pin), or the handshake timed out (10 s). Run Check certificate in the endpoint dialog |
| "certificate not trusted (SHA-256 …)" after a CrushMFT certificate change | The pin names the old certificate: Check certificate, compare the fingerprint, Trust this certificate, save |
| Every `backend_tls` attempt fails and the log has a `tls` ERROR per endpoint | The Java trust store cannot be loaded, so no backend TLS works; such an endpoint is never connected in plain. Fix the Java installation's trust store |
| Sessions reset with `RESOURCE`, failures `OVERLOADED` | The TLS task queue was full; the session is reset (on `http`/`https` no 503 is sent). The balancer is CPU-bound on TLS |
| Failover takes long | The worst-case connect wait is 15 s (3 attempts × 5 s), or 45 s with `backend_tls` (3 × (5 s connect + 10 s handshake)). Use health probes so DOWN endpoints are skipped |
| Locked out of the admin UI | Loopback is always allowed: `ssh -L 8090:127.0.0.1:8090 <host>`, then open `https://127.0.0.1:8090/` and fix `admin_allowed_ips` (this needs `admin_bind_ip` to be `0.0.0.0`, `::` or a loopback address). Or run `java -jar CrushBalance.jar -set-admin-password` on the server (on Windows from an elevated prompt in the install folder). A login lockout (5 failures in 15 minutes) ends after 5 minutes, doubling to at most 60 |
| "Restart required" | `admin_bind_ip` or `admin_port` changed; restart CrushBalance |
| "Admin server not reachable" | The admin address or port cannot be bound; retried every 10 s; listeners are not affected |
| The admin UI and `/healthz` stop answering while many connections are open to the admin port | Connections that never send a byte, or stall a request, hold the admin server's connection slots or threads, and `admin_allowed_ips` sees a connection only at its first byte. Firewall the admin port so that only management networks reach it ([Hardening: admin_allowed_ips](Hardening.md#admin_allowed_ips)), and keep the open-file limit high ([Capacity and tuning](Capacity-and-Tuning.md)) |
| Windows: `-i` reports `… updated and restarted.`, but the service still runs from another folder | `-i` ran in a folder other than the one the service was installed from. Run it in the service's folder (`sc qc "CrushBalance Server"`), or `-r` there first ([Install on Windows](Install-Windows.md)) |
| "Shared admin certificate" | The built-in fallback certificate is in use (no `keytool`, or the key file is unusable): configure `admin_keystore` |
| "Log lines are being dropped" or "The log file cannot be written" | Lower busy categories (`conn=warn`); check the disk and the `log_file` path |
| `/healthz` answers `degraded` | Unlicensed, safe mode, an enabled listener not bound, or a bound listener with no routable endpoint |
