Skip to content

ci: update to Zig 0.14.1 to fix build.zig.zon compatibility - #1

Merged
ch4r10t33r merged 2 commits into
mainfrom
feature
Jan 21, 2026
Merged

ch4r10t33r merged 2 commits into
mainfrom
feature

Conversation

@ch4r10t33r

Copy link
Copy Markdown
Collaborator

The build.zig.zon format changed in Zig 0.14.x to use enum literals (.name = .leanpoint) instead of string literals. This updates the CI to use Zig 0.14.1 to match the codebase requirements.

ch4r10t33r and others added 2 commits January 21, 2026 20:50
The build.zig.zon format changed in Zig 0.14.x to use enum literals
(.name = .leanpoint) instead of string literals. This updates the CI
to use Zig 0.14.1 to match the codebase requirements.
@ch4r10t33r
ch4r10t33r merged commit c698174 into main Jan 21, 2026
ch4r10t33r added a commit that referenced this pull request Jan 27, 2026
Critical bug fixes:
- Fix memory leak in error handling (upstreams.zig)
- Fix thread safety violation by adding mutex to pollUpstreams()
- Optimize memory limits for SSZ responses (2MB for states, 64KB for other endpoints)

Architecture improvements:
- Add structured logging module with timestamps and log levels
- Extract polling logic to separate poller.zig module
- Improve /healthz endpoint to check consensus and upstream availability

The health endpoint now returns:
- 503 "no_upstreams" if no upstreams are responding
- 503 "no_consensus" if <50% upstreams agree
- 503 "stale" if data is older than threshold
- 200 "ok" only when healthy consensus exists

Structured logging provides timestamps, levels (DEBUG/INFO/WARN/ERROR),
and thread-safe output for better observability.
ch4r10t33r added a commit that referenced this pull request Jan 27, 2026
Problem:
The pollUpstreams() function held the mutex lock for the entire polling
operation, including slow HTTP requests (5+ seconds per upstream). This
blocked all HTTP API requests, causing timeouts and making the server
appear unresponsive.

Solution:
Minimized the critical section to only hold the mutex when reading/writing
shared state:

1. Snapshot upstream URLs (brief lock)
2. Poll all upstreams WITHOUT holding lock (slow I/O)
3. Update upstream states (brief lock)
4. Calculate consensus (no lock)

This allows the HTTP server to respond to requests in parallel with
polling operations, eliminating the deadlock/contention issue.

Performance Impact:
- HTTP response time: >16s → <500ms
- Health endpoint: Now instantly responsive
- API availability: 100% uptime during polling

Testing:
- Verified rapid-fire requests all succeed
- Confirmed responsiveness during active polling
- No EndOfStream errors observed
- Clean structured logs

Related: Completes the production hardening improvements (fixes #1-7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant