Skip to content

Files marked as incomplete #809

Closed
Closed

Description

@StuartFerguson

There are a number of files where the completed event has not been written to the aggregate and therefore the db record is marked as incomplete.

Here are some example aggregates:

FileAggregate-fc9c78001c2522c70d34c89e19047014
FileAggregate-6dca2ab10bce4994c7d508206b0bedfe
FileAggregate-8a4f293e546f994d0829a79b1e4643d3
FileAggregate-b70a0b737795c5477314bcee57ab3ac0
FileAggregate-4e3098750e8c496f1a3cd88df8b9fba3
FileAggregate-992939060f197b86f50ecccf77bf3eba
FileAggregate-ced3b899015ec3c877b2871f5ac6f1e6
FileAggregate-2f68e945391bf1b7c0b3e7cde0b4b53b
FileAggregate-bedeaf9a82a4838af01f4db2cce1123f
FileAggregate-a1a8ee805b301f1f00525c7bc02da119

On initial investigation its like and event hasnt been played to process a line or the response not made it back to the aggregate.

http://192.168.1.86:2113/web/index.html#/streams/FileAggregate-6dca2ab10bce4994c7d508206b0bedfe might be a good example as the stream is quite small

Activity

  1. StuartFerguson commented on Sep 25, 2026

    @StuartFerguson
    MemberAuthor

    Investigation of FileAggregate-6dca2ab10bce4994c7d508206b0bedfe found that all source FileLineAddedEvent events exist, but line 7 has no terminal processing event.

    Observed stream sequence:

    • Lines 1, 9: FileLineProcessingIgnoredEvent
    • Lines 2–5 and 8: FileLineProcessingSuccessfulEvent
    • Line 6: FileLineTransactionDispatchFailedEvent only
    • Line 7: no processing result event
    • No FileProcessingCompletedEvent

    Suggested code changes:

    1. Propagate failed handler results from DomainEventHandlers.HandleDomainEvent. It currently awaits Task.WhenAll(tasks) but ignores the returned Result values and always returns HTTP 200. Failed processing should return a non-success response so EventStore retries the event.
    Result[] results = await Task.WhenAll(tasks);
    
    if (results.Any(result => result.IsFailed))
    {
        return Results.StatusCode(StatusCodes.Status500InternalServerError);
    }
    
    return Results.Ok();
    1. Prevent concurrent writes to the same FileAggregate. The subscription currently uses IsOrdered: false and InflightMessages: 100, allowing several lines from one aggregate to load/save concurrently. The short-term mitigation is ordered/single-inflight processing; the better long-term solution is aggregate/stream-keyed serialization.

    2. Ensure aggregate save/version conflicts remain retryable. ApplyFileUpdates converts exceptions and save failures into failed Result values, but those failures must reach the HTTP layer as non-success responses.

    3. Add tests for failed-result HTTP propagation, aggregate concurrency/save conflicts, idempotent redelivery, and retrying dispatch failures.

    4. Add recovery/monitoring for aggregates with lines still marked NotProcessed, since already-acknowledged events will not be retried automatically.

    The exact line-7 exception cannot be identified because the logs are no longer available, but the stream confirms that the input event exists and its processing result was never persisted.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions