Skip to content

perf: guard hot-path logger.warn on the consensus thread (CONV-1)#118

Merged
emrebulutlar merged 1 commit into
mainfrom
fix/conv-1-hotpath-log-guard
Jul 8, 2026
Merged

perf: guard hot-path logger.warn on the consensus thread (CONV-1)#118
emrebulutlar merged 1 commit into
mainfrom
fix/conv-1-hotpath-log-guard

Conversation

@emrebulutlar

Copy link
Copy Markdown
Member

Phase 0 · CONV-1 — see POST-SPRINT-REMEDIATION-PLAN.md

The custom Logger.warn(String, Object...) builds the varargs Object[] and boxes its primitive args (plus any eager OrderRejectReason.describe(...) string) at the call site, before warn()'s own level guard. The default level is ERROR, so every Engine reject-path warn allocated on the consensus thread even though nothing was printed — precisely during a reject storm, which the repo's own hot-path-allocations.md flags and the zero-alloc hot-path priority forbids.

Change:

  • Add Logger.isWarn().
  • Guard all ten reject / could-not-rest logger.warn(...) sites in Engine.java with if (logger.isWarn()) logger.warn(...), so the argument list is built only when WARN is enabled. At ERROR level these paths now allocate nothing.
  • Update the hot-path-allocations.md reject-path entry (FIXED).

No behavior change to the reject paths. Engine tests green: EngineTest (42), EnginePublisherIntegrationTest (23), DirectMatchingEngineTest (21) — 86 total, 0 failures. Deploy needs a rolling restart to pick up the engine jar.

Closes #117

🤖 Generated with Claude Code

…(CONV-1)

Logger.warn(String, Object...) builds the varargs Object[] and boxes its
primitive args (plus any OrderRejectReason.describe(...) string) at the call
site BEFORE warn()'s own level check, so every Engine reject-path warn allocated
on the consensus thread even at the default ERROR level where nothing prints —
exactly during a reject storm. Add Logger.isWarn() and guard all ten reject /
could-not-rest warn sites with `if (logger.isWarn()) logger.warn(...)`, so the
argument list is only built when WARN logging is enabled. At ERROR level these
paths now allocate nothing. Updates the hot-path-allocations audit.

Closes #117

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CfrBZ6nUcBkWzMq8FioNSP
@emrebulutlar
emrebulutlar merged commit 094d3d7 into main Jul 8, 2026
2 checks passed
@emrebulutlar
emrebulutlar deleted the fix/conv-1-hotpath-log-guard branch July 8, 2026 15:31
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.

CONV-1: hot-path logger.warn allocates varargs on the consensus thread

1 participant