Skip to content

Adopt native Kafka empty-metadata recovery fix and validate reconnect #169

Closed as not planned

Description

@thomhurst

Superseded by #154, which now owns all remaining acceptance criteria and the direct upstream dependency. The historical investigation follows; its evidence has moved under #154 for retention.

Remaining work: adopt the native correction

The stall is reproduced and diagnosed. The correction is implemented in draft thomhurst/Dekaf#4041, closing thomhurst/Dekaf#4038. Relayer must consume a released Dekaf package containing that correction. A verified native cross-repository blocked_by dependency links this issue to Dekaf#4038.

on-hold ends when a published Dekaf version includes #4041. Then remove the hold, update Directory.Packages.props, update the Kafka website documentation in the same PR, and validate the released package with the existing reconnect contract and concurrent integration suite. Do not replace the native client, catch exception-message strings, restart native consumers in Relayer, add unconditional retries, suppress assertions, or increase deadlines.

Acceptance criteria:

  • Adopt a published Dekaf package containing the empty-broker coordinator discovery correction.
  • Validate the unchanged two-minute Kafka reconnect contract and real-broker Kafka suite under concurrent load with the released package.
  • Retain failing and corrected evidence separately, and update the Kafka docs with the adoption.

Completed diagnosis and correction

Main defcf88 reproduces the unchanged Relayer reconnect scenario: 11/12 concurrent cases pass, one stalls during receive completion. At 00:27:57.606 graceful shutdown returns Refreshed metadata: 0 brokers, 1 topics. ConsumerCoordinator.FindCoordinatorCoreAsync throws InvalidOperationException: No brokers available before native retry handling, permanently faulting the receive task. The same broker is ready at 00:28:21.236 and acknowledges the post-restart send at 00:28:21.276. A live heap dump verifies the faulted receive task while the producer and broker are healthy.

The minimal native-only reproduction and a real-broker reproduction are filed in Dekaf#4038. With a 50 ms native metadata refresh interval exposing the shutdown window, 3/18 native recoveries fail with the same exception; no Relayer reference is present. Default native and separately scheduled native controls each pass 18/18. These controls do not establish a fix.

Dekaf#4041 refreshes an empty broker cache through the existing native metadata recovery, then uses typed retriable CoordinatorNotAvailable when still empty. Existing join backoff, cancellation and rebalance deadline remain authoritative. Single-attempt offset initialization still defers recovery without waiting on network while holding the assignment lock. The identical share-consumer guard is separately tracked in Dekaf#4039.

Validation and limits

Final native source is PR #4041 head fea01d21bca2c9d53a62629cd86cfdc1c4b2e361. Native coordinator tests pass 219/219, including five new deterministic regressions; the dedicated real-broker empty-metadata regression passes 1/1; net10.0/net8.0/netstandard2.0 build has zero warnings/errors; the native docs site builds.

Using the final native DLL (SHA-256 CB4C8849D1400ECC9B50932A4A449997B90F67F0411394EC9BCD955A2E0F60CE) with the unchanged, previously compiled Relayer caller assemblies:

  • Native real-broker reconnect probe: 18/18 recoveries, including four observed zero-broker metadata responses.
  • Relayer reconnect conformance load: 12/12 recoveries.
  • Complete Kafka test assembly: 25/25 passed in 1m 14s.

These final experiments overlap under concurrent broker/test load. They substitute only locally built native assemblies and are diagnostic validation of the correction, not adoption of a released package. The baseline client is Dekaf 1.25.0; the patched client is current upstream main plus the correction. Native red/green unit regressions isolate the guard change. The unchanged original full solution passes 831/831. An earlier patch build also passes 831/831, but predates the final single-attempt guard and is not claimed as final-head validation.

A separate first-patch adapter startup fails before native initialization with a Windows fixed-port reservation collision; #171 tracks that fixture defect. The failing run is preserved, not retried for green. It is independent of native reconnect recovery and does not need to block package adoption.

All source snapshots, loaded binaries, raw logs/reports, native-only probe projects, broker logs, live heap dump and SHA-256 inventories remain under C:/git/Relayer-evidence/issue-154/issue-169-diagnosis/: current-baseline, conformance-load, native-empty-metadata, native-refresh, native-scheduled, corrected-*, final-native-refresh, final-conformance-load, and final-kafka-suite. Original/archive hashes match for all 1,333 baseline solution output files. Native PR evidence is under C:/git/Dekaf-evidence/pr-4041/fea01d21bca2c9d53a62629cd86cfdc1c4b2e361/.

Parent #154 remains open for released-package adoption. No root-cause change is needed in Relayer's production receive/send adapters; native send, settlement and recovery semantics stay native. No local binaries or investigation outputs are committed.

Activity

  1. added
    bug
    area: kafka
    P2
    on Nov 2, 2026
  2. added
    in-progress
    on Nov 2, 2026
  3. thomhurst commented on Nov 2, 2026

    @thomhurst
    OwnerAuthor

    Blocker-first investigation from #149 completed these distinct experiments without reproducing the post-restart stall:

    • Windows Release build, then full concurrent solution suite with the diagnostic snapshot: 825/825 passed in 2m 02s. Kafka completed in 40.9 seconds.
    • Eight real Relayer producer/consumer pairs on one Kafka 4.0.2 broker, including the conformance stop/start drain before each broker restart: all 24 recoveries passed across immediate, 15-second and 50-second outages. The probe checks receive-task faults separately from receive completion. Native Debug logs and exact probe source/binaries are retained. This does not demonstrate an upstream defect or a fix.
    • Linux SDK 10.0.403, isolated Docker 28.5.1 with two CPUs for the daemon and its nested containers: 25/25 Kafka tests passed in 1m 28.8s, including reconnect under concurrent broker startup. The initial attempt failed on cold image pulls and was stopped after the bounded fixtures reported cancellation; it is retained separately. A cached Kafka image was imported correctly before the second attempt. No test deadline, assertion, retry policy or production code changed.

    Evidence: C:/git/Relayer-evidence/issue-169/. baseline-source.tar plus diagnostics-input.patch identify the measured source (main 723181d plus the then-current #168 diagnostic snapshot). windows-baseline/ retains 1,405 source/report/binary files and its SHA-256 inventory. All 362 copied Linux artifact/report files were SHA-256 checked against their container originals in linux-original.sha256. The stopped owned containers retain originals. The original Windows native-only probe copied by the #168 worker remains under native-probe/. These measurements predate final #170 and are not claimed as validation of a future #149 head.

    #170 has now merged the final diagnostics to main. The next useful hosted experiment is to rebase #149 onto that main, repeat its head-bound review lifecycle, and let fresh ready CI identify the original phase if reconnect fails again. I reacquired #149 after its temporary lock holder released it. No root-cause correction is claimed here; this issue remains actionable. No on-hold or needs-human label is appropriate.

  4. added
    in-progress
    and removed
    in-progress
    on Nov 2, 2026
  5. thomhurst commented on Nov 2, 2026

    @thomhurst
    OwnerAuthor

    The stall is diagnosed and its native correction is implemented in draft thomhurst/Dekaf#4041 (head fea01d21bca2c9d53a62629cd86cfdc1c4b2e361), closing Dekaf#4038. A zero-broker metadata response during graceful shutdown permanently faulted coordinator discovery with InvalidOperationException: No brokers available. The producer acknowledged the post-restart send; the faulted receiver never delivered it. The native issue contains minimal and real-broker reproductions, and this issue has a verified cross-repository blocked_by dependency.

    Final native correction passes 219 coordinator tests (five new deterministic regressions), one dedicated real-broker regression, all native target-framework builds, and the native docs build. Using the final native DLL with unchanged Relayer callers, concurrent real-broker validation passes:

    • Native probe: 18/18 recoveries, including four zero-broker metadata responses.
    • Relayer reconnect conformance: 12/12 recoveries.
    • Complete Kafka suite: 25/25.

    These local assembly-substitution experiments validate the correction but do not adopt a released package. The unchanged baseline solution passes 831/831; an earlier patch also passes 831/831 but predates the final single-attempt offset-lookup guard. No earlier result is presented as final-head validation. The first patch experiment has a separate pre-start Windows port collision, filed as #171; its failure is retained alongside the passing runs. The native share-consumer guard is separately filed as Dekaf#4039.

    The body now describes only remaining adoption work. on-hold ends when a published Dekaf package includes #4041; then update the central package version and Kafka website docs and validate that released package. Relayer must keep reconnect native, with no exception-message matching, consumer recreation, retries, or deadline changes. Parent #154 remains open for this release adoption.

    Evidence is retained under C:/git/Relayer-evidence/issue-169/ with source snapshots, exact loaded binaries, native-only projects, raw failed/passing logs/reports, broker logs, live heap dump, and diagnosed-inventory.sha256.json. All 1,333 original/archive baseline binary hashes match; final runtime DLL SHA-256 is CB4C8849D1400ECC9B50932A4A449997B90F67F0411394EC9BCD955A2E0F60CE. Native PR source/test evidence is retained under C:/git/Dekaf-evidence/pr-4041/fea01d21bca2c9d53a62629cd86cfdc1c4b2e361/. No Relayer production change or local binary is committed. This is a demonstrated upstream release gate, replacing the earlier undiagnosed blocker.

  6. added
    on-hold
    and removed
    in-progress
    on Nov 2, 2026
  7. changed the title [-]Diagnose and fix post-restart Kafka reconnect stalls using native diagnostics[/-] [+]Adopt native Kafka empty-metadata recovery fix and validate reconnect[/+] on Nov 2, 2026
  8. removed
    on-hold
    on Nov 2, 2026
  9. thomhurst commented on Nov 2, 2026

    @thomhurst
    OwnerAuthor

    Superseded by #154: its only remaining open child's acceptance criteria now live directly in the parent, including the central package update, matching Kafka website change, unchanged two-minute reconnect contract, concurrent real-broker validation, and separate failing/corrected evidence. No implementation criterion is dropped.

    The release condition remains unmet: Dekaf#4041 is ready with auto-merge armed and CI/performance runs in progress, while NuGet and GitHub releases still list 1.25.0 as latest. #154 now directly depends on Dekaf#4038 and carries the release gate. #171 remains independently claimable; it does not require this release.

    Before closing this duplicate, all 9,765 evidence files were moved to C:/git/Relayer-evidence/issue-154/issue-169-diagnosis/ and checked against their original lengths and SHA-256 hashes. The migration inventory is C:/git/Relayer-evidence/issue-154/issue-169-migration-inventory.json. Historical references to the old issue-169 path should use this retained location. No new test run or released-package adoption is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area: kafkabug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions