ZooKeeper unrecoverable error: when a node’s integrity is compromised
You got paged because zk_unrecoverable_error_count incremented. This is one of the few mntr counters you never want to see move. It tracks errors ZooKeeper cannot recover from internally: data corruption, invariant violations, or resource exhaustion that puts the node into a state it cannot safely keep serving from.
ZooKeeper is designed to fail fast. When it hits an unrecoverable condition it does not limp along. The critical thread logs a severe error, notifies the supervision listener, and the process exits. By the time the counter increments, the JVM is usually already gone or about to be, and the question is no longer “is this node healthy” but “do I trust its on-disk state at all”.
This guide covers first-five-minute checks, correlated integrity metrics, and the decision between a clean restart and a full rebuild from a trusted snapshot.
What this means
zk_unrecoverable_error_count is exposed by mntr and counts critical internal failures since process start. Any increment pages because the integrity of the node’s data tree may be compromised: the server may have served incorrect data, written a partial transaction, or hit an internal invariant violation.
Three things are true the moment this counter increments:
- The ZooKeeper process is either dead or about to exit. Fail-fast is intentional, not a bug.
- The node’s on-disk snapshot and transaction log cannot be assumed trustworthy without verification.
- The blast radius depends on whether the rest of the ensemble still has quorum. If this was the leader or a quorum-critical follower, dependent services (Kafka controller, HBase master, Solr overseer) are about to react to leadership changes.
The triage question is whether this is an isolated node failure or a systemic integrity problem. Correlate with zk_digest_mismatches_count and zk_snapshot_error_count. Multiple error types incrementing together indicates a systemic problem, not a transient blip.
flowchart TD
A["Disk full / IO error / perm denied"] --> B["SyncRequestProcessor catches Throwable"]
B --> C["ZooKeeperCriticalThread.handleException"]
C --> D["Increment zk_unrecoverable_error_count"]
C --> E["Log severe unrecoverable error"]
C --> F["listener.notifyStopping"]
F --> G["Process exit"]
G --> H["Ensemble shrinks"]
H --> I{"Quorum lost?"}
I -->|Yes| J["Writes unavailable ensemble-wide"]
I -->|No| K["Followers re-elect a leader"]
J --> L["Dependent services cascade"]
K --> M["Single-node rebuild path"]The recovery path forks at the bottom of that diagram. A quorum-losing event needs immediate ensemble triage; a single-node failure in a healthy ensemble follows the rebuild path described later in this guide.
Common causes
| Cause | What it looks like | First thing to check |
|---|---|---|
| Transaction log disk full | Process exits mid-write; dataLogDir partition at 100% | df -h on the txnlog partition |
| Disk I/O or hardware error | Process exits with IOException in txnlog; kernel logs report medium error | dmesg, iostat -x, smartctl -a |
| Permission denied on data directory | Common in containerized deploys; fails at startup or snapshot rotation | ls -la on dataDir and dataLogDir |
| Digest mismatch during load or sync | zk_digest_mismatches_count increments alongside | Check the same counter on every ensemble member |
| Snapshot write or load failure | zk_snapshot_error_count increments before the crash | Inspect latest snapshot file size and integrity |
| 32-bit JVM hitting file size limit | Process exits when a txnlog segment crosses ~2GB | Confirm JVM architecture: java -version |
The dominant production trigger is a full or failing dataLogDir. ZooKeeper fsyncs every write synchronously, so any condition that blocks or fails that fsync is a candidate.
Quick checks
Run these read-only. None modify state.
# Confirm the increment is real (run on the affected node)
echo mntr | nc localhost 2181 | grep -E 'zk_unrecoverable_error_count|zk_digest_mismatches_count|zk_snapshot_error_count|zk_restore_error_count'
# Is the process actually still alive?
echo ruok | nc localhost 2181
echo isro | nc localhost 2181
echo mntr | nc localhost 2181 | grep -E 'zk_server_state|zk_uptime'
# Disk space on both persistence partitions
df -h /var/zookeeper/txnlog /var/zookeeper/data
# Disk health and current IO pressure
iostat -x 1 5
dmesg -T | grep -iE 'error|medium|i/o' | tail -30
# Find the actual error in the ZK log
grep -iE 'unrecoverable|severe|IOException|denied|digest' /var/log/zookeeper/zookeeper.log | tail -50
# Compare integrity counters across the whole ensemble
for h in zk1 zk2 zk3; do
echo "== $h =="
echo mntr | nc "$h" 2181 | grep -E 'zk_unrecoverable_error_count|zk_digest_mismatches_count|zk_snapshot_error_count'
done
The ensemble-wide sweep matters. A single node incrementing only zk_unrecoverable_error_count is a different incident from three nodes all incrementing zk_digest_mismatches_count at the same zxid.
How to diagnose it
Confirm the counter delta. Compare the current value against your last scrape. Absolute values are meaningless for alerting because they include historical events. Alert on
increase(zk_unrecoverable_error_count) > 0.Verify process state. If
ruokdoes not returnimok, the JVM has already exited. Checkzk_uptimeagainst your last known value: a reset indicates a restart, consistent with fail-fast exit.Read the ZooKeeper log around the timestamp. Search for “Severe unrecoverable error” and the surrounding stack trace. The thread name tells you which subsystem hit the error. SyncRequestProcessor failures point at the txnlog disk; snapshot-related failures point at
dataDiror memory pressure.Pull the correlated counters from every ensemble member. This is the single most important step. Three signals to correlate:
zk_digest_mismatches_count- data tree divergence from the expected checksumzk_snapshot_error_count- errors during snapshot creation or loadzk_restore_error_count- errors during state restore
If only the unrecoverable counter moved on one node, you have a localized failure. If digest mismatches moved on multiple nodes, you have an ensemble-wide integrity problem and the recovery path is different.
Identify the trigger. Match the log entry to system state at that instant:
- Disk full:
dfhistory or your disk-space metric will show the partition hit 100%. - I/O error:
dmesgwill show SCSI/ATA errors; SMART will show reallocated sectors. - Permission denied: recent container image change, user change, or volume mount option change.
- Digest mismatch during follower sync: usually indicates the follower’s local state diverged, often after an unclean shutdown.
- Disk full:
Decide on the recovery path. Covered in the next section. The decision tree is: is the on-disk state trustworthy, and is the rest of the ensemble healthy?
Metrics and signals to monitor
| Signal | Why it matters | Warning sign |
|---|---|---|
zk_unrecoverable_error_count | Primary page signal. Any delta is catastrophic. | Any increment, ever |
zk_digest_mismatches_count | Confirms or rules out data corruption. Moving on multiple nodes means systemic. | Any increment |
zk_snapshot_error_count | Indicates the node cannot persist its state safely. Recovery after crash is at risk. | Any increment; escalate to PAGE if unrecoverable also moves |
zk_uptime | Resets on process exit. Confirms the fail-fast exit happened. | Sudden reset outside planned restart |
zk_server_state | Tells you whether the dead node was leader. A leader exit triggers election. | Unplanned transition |
zk_synced_followers (leader only) | Tells you whether the surviving ensemble still has quorum headroom. | Drops to floor(N/2) |
Disk free on dataLogDir | The dominant root cause. Monitor as a leading indicator. | Trend toward zero |
zk_fsynctime p99 | Underlying write-path health. Sustained elevation precedes many crashes. | Sustained p99 > 10ms |
Fixes
Recovery depends on root cause and whether the on-disk state is trustworthy. Never restart a node and assume it is healthy without first verifying why it crashed.
Disk full on the transaction log partition
Clearing space is necessary but not sufficient. The process exited because fsync failed; it will not resume on its own once space is freed.
- Free space. Usually that means triggering autopurge manually or removing old snapshots outside the retain set. Be careful: deleting the wrong files corrupts recovery state.
- Restart the ZooKeeper process under your supervisor (systemd, supervisord, kubectl, etc.).
- Verify the node rejoins cleanly:
zk_server_stateshould reportfollower(orleaderafter election),zk_uptimeshould be increasing, andzk_synced_followerson the leader should include this node. - Configure
autopurge.purgeIntervalandautopurge.snapRetainCountif they are not set, so this does not recur.
See the dedicated guide on autopurge misconfiguration and on the txnlog disk full crash.
Disk I/O or hardware errors
If dmesg or SMART report failing storage, the on-disk state cannot be trusted even if the files look intact.
- Evacuate the node: remove it from the ensemble membership or stop the process.
- Replace or reformat the failing disk.
- Wipe
dataDiranddataLogDiron the affected node and let it perform a full sync from the leader. Warning: this destroys the node’s local data tree; only do this when the rest of the ensemble has a trusted leader. For a large data tree this will be a SNAP sync; see the SNAP sync blast radius guide. - Watch
zk_follower_sync_timeand confirm the node rejoinszk_synced_followersbefore returning it to service.
Permission denied on the data directory
Most common after a container image change, a UID rewrite, or a volume mount option change. The fix is operational, not data-related.
- Confirm the ZooKeeper process user owns
dataDiranddataLogDir:ls -la /var/zookeeper/data /var/zookeeper/txnlog. - Fix ownership:
chown -R zookeeper:zookeeper /var/zookeeper/data /var/zookeeper/txnlog. - Check the container spec or systemd unit for
User=,fsGroup, orsecurityContextdrift. - Restart. Existing data is fine; the failure was on a new file write or snapshot rotation.
Digest mismatch or confirmed data corruption
This is the worst case. A digest mismatch means the in-memory tree diverged from the expected checksum, and clients may have been reading incorrect data.
- Check
zk_digest_mismatches_counton every ensemble node. - Single node only: remove the node from the ensemble, wipe its
dataDiranddataLogDir, and let it rebuild from a healthy leader via SNAP sync. Warning: wiping is destructive; confirm you have a trusted leader before deleting local state. Do not trust its local snapshot. - Multiple nodes: escalate immediately. You likely need to restore from an external backup taken before the divergence, or rebuild the ensemble from a known-good snapshot. Do not pick a “winner” among divergent nodes without understanding which copy is authoritative for your downstream services.
- After recovery, audit downstream consumers (Kafka, HBase, Solr) for state that may have been written based on stale or corrupt reads.
If snapshot.trust.empty is set to true on this node, revisit that decision. It allows recovery when snapshot files are missing but transaction logs exist, but misusing it during upgrades has caused znodes to vanish. It should be false in steady state.
File too large on a 32-bit JVM
If java -version reports a 32-bit JVM and the txnlog segment is approaching 2GB, migrate to a 64-bit JVM. This is a deploy-time fix, not a runtime one. Wipe the node’s data after the upgrade and let it resync.
Prevention
- Monitor the integrity counters as a group. Alert on
increase(zk_unrecoverable_error_count) > 0and escalate severity whenzk_digest_mismatches_countorzk_snapshot_error_countmove in the same window. - Treat
dataLogDirfree space as a leading indicator. Disk full is the dominant root cause. Page on< 10%or< 2GBfree, whichever comes first. - Keep
dataLogDiron dedicated storage. Sharing the txnlog volume with snapshots or other workloads is the single most common cause of fsync stalls that escalate into unrecoverable errors. See the dataLogDir separation guide. - Configure autopurge.
autopurge.purgeIntervalandautopurge.snapRetainCountmust be set explicitly; the default in some distributions is disabled. - Watch fsync latency trends. Sustained
zk_fsynctimep99 growth predicts storage problems before they become crashes. - Keep
snapshot.trust.empty=falsein steady state. Only flip it during a controlled upgrade and revert immediately after. - Run a 64-bit JVM. The 2GB txnlog ceiling on 32-bit JVMs is an avoidable failure mode.
- Test recovery. A node that cannot rejoin via SNAP sync in a reasonable time is a hidden incident. Large data trees make rebuilds slow.
How Netdata helps
- Per-second scraping of the integrity counters. The increment shows up within a second, with no
mntrparsing lag, and the delta is computed for you so historical absolute values do not generate repeat alerts. - Same-dashboard correlation of
zk_unrecoverable_error_count,zk_digest_mismatches_count, andzk_snapshot_error_count. The systemic-versus-isolated call is visual instead of four separate terminal sessions. - Disk space, disk I/O, and filesystem metrics on the same host. The dominant root cause is visible alongside the symptom, with per-device breakdowns for
dataLogDirversusdataDirwhen they are on separate volumes. - Leader-aware multi-node views.
zk_server_state,zk_synced_followers, andzk_uptimeacross the ensemble make it immediately clear whether quorum was lost and which node needs the rebuild. - Cold-start suppression. Restart storms immediately after a fail-fast exit do not generate noise from non-critical metrics, while the integrity counters themselves still page.
Related guides
- ZooKeeper data size growing: using ZooKeeper as a database is an anti-pattern
- ZooKeeper autopurge not configured: snapshots and logs filling the disk over months
- ZooKeeper avg_latency hides write stalls: why the headline number lies
- ZooKeeper “Cannot open channel to N at election address”: the blocked election port
- ZooKeeper “Client session timed out, have not heard from server”: the heartbeat miss
- ZooKeeper connection drops spiking: sessions dying in bursts
- ZooKeeper KeeperErrorCode = ConnectionLoss: the transient disconnect every client hits
- ZooKeeper dataLogDir sharing a disk with snapshots: the #1 fsync-latency footgun
- ZooKeeper “Detected pause in JVM or host machine (eg GC)”: the pause-monitor warning
- ZooKeeper transaction log disk full: the crash with no graceful degradation
- ZooKeeper follower doing a SNAP sync: full snapshot transfer and its blast radius
- ZooKeeper follower sync time climbing: a follower approaching ejection






