Repository navigation
debugging
Pre-Alpha. This page describes behavior that may change.
Debugging Ze is mostly a matter of knowing which tool to reach for. The daemon has a lot of surfaces, and the right tool depends on what you are trying to see. This page lists the tools that pay off most often.
| Tool | What it is for |
|---|---|
ze config dump |
Inspect parsed configuration. |
ze config validate |
Check a config file without starting the daemon. |
ze.log.* |
Per-subsystem debug logging. |
ze cli monitor event |
Live event stream, filterable. |
ze cli monitor bgp |
Live peer dashboard. |
ze show warnings, ze show errors
|
Operational report bus. |
ze doctor, show doctor
|
Every known problem with its cause and the command that fixes it. |
ze bgp decode |
Decode raw BGP wire bytes into structured JSON. |
ze bgp encode |
Encode route commands into BGP wire bytes. |
ze debug <module> |
Granular debug toggle (persistent in debug.zefs). |
show debug |
Live debug module state from the running daemon. |
ze --pprof <addr:port> |
Start the pprof HTTP profiler. |
ze signal quit |
Goroutine dump to stderr (kills the daemon). |
./le test <suite> --server N / --client N
|
Interactive functional test debugging. |
Most Ze debugging starts with more log output. The levels are hierarchical, so you can be specific.
ze -d start config.conf # Base level debug
ZE_LOG_BGP_REACTOR=debug ze start config.conf # Just the reactor
ZE_LOG_BGP_REACTOR_PEER=debug ze start config.conf # Just peer lifecycleAt runtime, without a restart:
ze cli -c "request log level bgp.reactor debug"
ze cli -c "request log level bgp.fsm debug"
ze cli -c "show log levels"The hierarchical naming means bgp.reactor=debug turns on debug for every bgp.reactor.* child subsystem at once. Use this when you need to see everything a single area is doing.
For longer debugging sessions, the granular debug system stores state in debug.zefs and survives daemon restarts (but is not auto-applied on reboot for safety).
ze debug bgp.reactor # Toggle debug on/off
ze debug bgp.reactor flag wire # Toggle a specific flag
ze debug bgp.reactor scope direction received # Filter by direction
ze debug profile save my-debug # Save current state as named profile
ze debug restore profile my-debug # Restore a named profile
ze debug clear # Clear all debug stateDuration units are required on the timeout command: ze debug bgp.reactor timeout 30s (not bare integers).
ze debug show reads the stored profile offline. To see the daemon's actual live state, use show debug inside the CLI or ze show debug from the shell. The two commands read different sources: debug show reads debug.zefs, show debug queries the running daemon via YANG dispatch.
When you are chasing a runtime bug that depends on what a peer is sending, the event stream is usually the fastest way to see it.
ze cli monitor event peer upstream include update direction received
ze cli monitor event include state # All peer state changes
ze cli monitor event exclude keepalive # Everything except heartbeatsPipe through | json for structured output, | match <regex> for a filter, | no-more for no paging.
If the daemon is not doing what the config says, the first question is "did the config parse the way I think it did?". ze config dump reads the file, parses it, and prints what Ze actually sees.
ze config dump config.conf
ze config dump --json config.conf # Structured outputThis is where you catch typos that survived validation, misplaced blocks that landed under the wrong container, and values that inherited differently than you expected.
When you have hex bytes from a packet capture, a log, or a peer that sent something odd, ze bgp decode turns them into structured JSON.
ze bgp decode --update <hex>
ze bgp decode --open <hex>
ze bgp decode --nlri ipv4/unicast <hex>Every path attribute that Ze knows how to parse gets decoded. The output format is the same JSON envelope that shows up in the live event stream, which makes comparisons across the two surfaces straightforward.
Going the other way, ze bgp encode takes a human-readable route command and produces the wire bytes.
ze bgp encode --nlri ipv4/unicast "announce route 10.0.0.0/24 next-hop 192.168.1.1"Round-tripping (encode, then decode, then compare) is a good sanity check when you suspect a bug in the encoder or the decoder.
ze show warnings and ze show errors are not log lines: they are state snapshots from the in-process report bus. If you have any doubt about whether something operational is happening right now, this is the first place to look.
ze show warnings | json
ze show errors | jsonFull coverage is in operational reports.
ze doctor (or show doctor inside the CLI) reads the same bus and adds the daemon's live checks: plugins that are down, refused reloads, events not delivered, environment values ze could not use. Each finding carries a fix: line with the command that clears it. See Health checks.
Ze logs this at WARN, with no debug logging needed, when it closes a session whose peer accepted no data:
level=WARN msg="BGP session closed: the peer accepted no data for the write budget; ze connects to it again by itself" subsystem=bgp.reactor.session peer=192.0.2.1 budget=30s fix="..." code=doctor-bgp-peer-not-reading
Ze had data to send, and for the whole write budget the peer took none of it while it kept the TCP connection open: its BGP process is not reading. Ze closes the connection with no NOTIFICATION, because the peer could not read one, and connects again by itself.
When a hold timer, a send hold timer or an operator ends the session first, the blocked route write still holds the session; ze then logs at ERROR with the code doctor-bgp-write-path-held, fails the blocked write and closes the connection.
| Where | What it shows |
|---|---|
ze show errors, ze show doctor
|
One event per close, code doctor-bgp-peer-not-reading, with the peer and the budget |
ze show bgp peer, field last-error
|
peer accepted no data for the write budget (no NOTIFICATION sent), until a later NOTIFICATION replaces it |
ze show diagnostic doctor-bgp-peer-not-reading |
The description of the code |
On the peer, find why its BGP process stopped reading (CPU load, a stalled process, a full input queue). The budget of a route write is ze.fwd.write.deadline (30 s by default); a KEEPALIVE, OPEN or NOTIFICATION gets a third of the hold time, between 10 s and 30 s. Raise ze.fwd.write.deadline only for a peer known to be slow and healthy.
With ze.log.bgp.server=debug, every BGP message batch that reached no plugin is logged with its reason, instead of being dropped without trace:
level=DEBUG msg="OnMessageBatchReceived: batch not delivered" reason="no subscriber and no monitor" peer=192.0.2.1 type=UPDATE dir=received msgs=4
The reason is no subscriber and no monitor, unknown message type or server shutting down. The check costs nothing with debug off.
Start the daemon with --pprof <addr:port> to enable the standard Go HTTP profiler.
ze --pprof 127.0.0.1:6060 config.confThen use go tool pprof to drive it.
go tool pprof -http :8080 http://localhost:6060/debug/pprof/profile?seconds=30 # CPU
go tool pprof -http :8080 http://localhost:6060/debug/pprof/heap # Heap
go tool pprof -http :8080 http://localhost:6060/debug/pprof/goroutine # GoroutinesThis is also the fastest way to see what the daemon is doing when it is hung: the goroutine profile shows every stack.
When the daemon is wedged and you want the full stack trace without a running pprof, ze signal quit dumps every goroutine stack to stderr and exits the process. This is the nuclear option: it kills the daemon. Use it when you have already collected the context you need and are willing to restart.
Functional tests run by ./le test can be debugged interactively.
./le test bgp encode --server 0 # Start server test 0, let it wait
./le test bgp plugin --client 3 # Start client test 3, let it waitThe test pauses at a known point, and you connect to it with a second shell to poke at the state. This is the right tool when a functional test is failing in CI but passing locally: run it interactively and watch the decoded messages as they go past.
The chaos framework produces NDJSON event logs that replay deterministically.
./le chaos run --event-log run.ndjson --seed <N> # Record the failing run
./le chaos run --replay run.ndjson # Reproduce it
./le chaos run --shrink run.ndjson > minimal.ndjson # Reduce to minimal reproCommit the shrunk scenario as a test. The test stays in the suite even after you fix the bug.
- Testing for the test suites that run every time.
- Logging for the operator view of logging.
- In-tree debugging tools for the full reference.
Adapted from main/docs/debugging-tools.md.
Unreviewed draft. This wiki was authored in bulk and has not been reviewed. File corrections on the issue tracker.
- Install
- Docker
- netlab
- Appliance
- Quick Start
- Use Ze with an AI agent
- ExaBGP Migration
- CLI Tour
- Web UI Tour
- Overview
- YANG Model
- Editor Workflow
- Archive and Rollback
- Backup and Restore
- System
- Interfaces
- VRRP
- BFD
- FIB
- OSPF
- IS-IS
- MPLS / LDP / RSVP-TE
- RSVP-TE
- SRv6
- Static Routes
- Policy Routing
- Firewall
- Traffic Control
- Class of Service
- L2TP/PPP
- PPPoE
- VPP Data Plane
- RPKI
- IPsec VPN
- Path MTU
- TACACS+ AAA
- RADIUS AAA
- AS112 DNS
- DNS
- Authorization
- Fleet
- BGP
- Starting and Stopping
- Show Commands
- Monitoring
- Telemetry
- Flow Export
- DDoS Mitigation
- Anomaly Detection
- Health Checks
- Audit Trail
- Production Diagnostics
- Logging
- Operational Reports
- Healthcheck
- Self-Update
- Zero-Touch Provisioning
- MRT Analysis
- Upgrade and Restart
- Storage
- Policy
- Core
- Resilience
- Validation
- Link State
- Capabilities
- Address Families
- Protocol
- Subsystems
- Infrastructure
- Route Server at an IXP
- Transit Edge with RPKI
- Public Looking Glass
- ExaBGP Migration Walkthrough
- FlowSpec Injection
- Chaos-Tested Peering
- AS Path Topology