Skip to content

Reduce memory pressure of reliable response reception - #77

Merged
pavel-kirienko merged 4 commits into
mainfrom
dev-zombie-compaction
Jul 27, 2026
Merged

Reduce memory pressure of reliable response reception#77
pavel-kirienko merged 4 commits into
mainfrom
dev-zombie-compaction

Conversation

@pavel-kirienko

Copy link
Copy Markdown
Member

Reduce memory pressure of reliable response reception: once the future that has seen reliable responses is discarded, do not keep it as a zombie but instead keep a much smaller 56-byte object behind to handle missed acks correctly.

…e that has seen reliable responses is discarded, do not keep it as a zombie but instead keep a much smaller 56-byte object behind to handle missed acks correctly.
@pavel-kirienko pavel-kirienko self-assigned this Jul 27, 2026
@pavel-kirienko
pavel-kirienko force-pushed the dev-zombie-compaction branch 2 times, most recently from 4c35d81 to 0e758fa Compare July 27, 2026 19:43
Test-only, except for a NULL guard in cy_topic_name():

- The intrusive fixtures crashed when built with CY_CONFIG_TRACE=1. Tracing
  calls cy_now() on every CY_TRACE, which publish_reliable left unset, and
  dereferences name indexes that reordering/topic_allocation left NULL on
  synthesized subscriber roots. A detached zeroed wkv_node_t suffices for the
  latter: wkv_get_key() terminates immediately on a parentless node.
- cy_topic_name() dereferenced index_name unguarded. No production path reads a
  topic in that state, but it is reachable for synthesized objects.

Verified: all 13 intrusive suites pass under -DCY_CONFIG_TRACE=1 with
AddressSanitizer and UndefinedBehaviorSanitizer; default suite unchanged.

Follow-ups from review, none changing behaviour on a reachable path:
- Sample cy_now() before deindexing, avoiding a vtable call mid-teardown.
- Drain retained ack records via the expiry list; every record is enlisted, and
  the trailing assertions then cover the tag tree instead.
- Assert the two ack-record structures stay in lockstep, and that a fresh
  response is always acked.
- Assert that request_ack_t and request_future_remote_t differ in size: the OOM
  tests select an allocation by its exact size, and the two collide on a 32-bit
  ABI that aligns uint64_t to 8.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pavel-kirienko
pavel-kirienko force-pushed the dev-zombie-compaction branch from 0e758fa to 6dd572d Compare July 27, 2026 20:02
@pavel-kirienko
pavel-kirienko marked this pull request as ready for review July 27, 2026 22:21
@pavel-kirienko
pavel-kirienko merged commit 977f7f7 into main Jul 27, 2026
8 checks passed
@pavel-kirienko
pavel-kirienko deleted the dev-zombie-compaction branch July 27, 2026 23:33
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