Skip to content

[DB-287] Improve the error message when subscribing from an invalid position#3963

Merged
hayley-jean merged 1 commit intomasterfrom
lakshdeepsingh/Improve-error-message-when-starting-catchup-subs-on-allstream-far-beyond-last-known-commit-position
Nov 13, 2023
Merged

[DB-287] Improve the error message when subscribing from an invalid position#3963
hayley-jean merged 1 commit intomasterfrom
lakshdeepsingh/Improve-error-message-when-starting-catchup-subs-on-allstream-far-beyond-last-known-commit-position

Conversation

@lakshdeepsingheventstore
Copy link
Copy Markdown
Contributor

@lakshdeepsingheventstore lakshdeepsingheventstore commented Sep 21, 2023

Fixed : #3195

Fixes : Improves the error message on the client side when a catch subscription is created from an invalid position. When the above mentioned exception was thrown, the error message on the client side was unclear stating "An exception was thrown by the handler", without specifying the actual error message, thus making it difficult to diagnose what the actual issue was. This PR improves the error message when the above issue is encountered.

Copy link
Copy Markdown
Contributor

@hayley-jean hayley-jean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error handling should also be added to the FilteredAllSubscription

Comment thread src/EventStore.Core/Services/Transport/Grpc/RpcExceptions.cs Outdated
Comment thread src/EventStore.Core/Services/Transport/Grpc/Enumerators.AllSubscription.cs Outdated
@hayley-jean hayley-jean changed the title Improve the error message when subscribing from an invalid position [DB-287] Improve the error message when subscribing from an invalid position Oct 12, 2023
@linear
Copy link
Copy Markdown

linear bot commented Oct 12, 2023

DB-287 Unclear exception message when starting subscription far beyond starting point (EventStore.Core.TransactionLog.Chunks.TFChunk.InvalidReadException)

Describe the bug
When I create a subscription with a checkpoint that's too large the system returns a technical exception that doesn't indicate what the problem is.

I ran into this on my development environment where I had deleted my event store docker container, but not the database where I store my checkpoints. From that point, my application wouldn't start anymore because the connection with ES was constantly failing.

It took me quite some time to figure out what the problem was. Of course, resetting the checkpoints solves the issue, but a clearer error message would have given an indication.

To Reproduce
Steps to reproduce the behavior:

  1. Store some events in the event store.
  2. Create a subscription using a checkpoint that's way higher than the end of the all stream.

Expected behavior
A clear exception message. Something like: You are attempting to create a subscription starting from position X, but the highest position is Y.

Actual behavior

[    1,24,06:46:36.624,ERR] Error during processing ReadAllEventsForward request.

EventStore.Core.TransactionLog.Chunks.TFChunk.InvalidReadException: Log record at actual pos 1 has too large length: 33554432 bytes, while limit is 16777216 bytes. In chunk #0-0 (chunk-000000.000000).

   at EventStore.Core.TransactionLog.Chunks.TFChunk.TFChunk.TFChunkReadSide.TryReadForwardInternal(ReaderWorkItem workItem, Int64 actualPosition, Int32& length, LogRecord& record) in /home/runner/work/TrainStation/TrainStation/build/oss-eventstore/src/EventStore.Core/TransactionLog/Chunks/TFChunk/TFChunkReadSide.cs:line 492

   at EventStore.Core.TransactionLog.Chunks.TFChunk.TFChunk.TFChunkReadSideUnscavenged.TryReadClosestForward(Int64 logicalPosition) in /home/runner/work/TrainStation/TrainStation/build/oss-eventstore/src/EventStore.Core/TransactionLog/Chunks/TFChunk/TFChunkReadSide.cs:line 74

   at EventStore.Core.TransactionLog.Chunks.TFChunkReader.TryReadNextInternal(Int32 retries) in /home/runner/work/TrainStation/TrainStation/build/oss-eventstore/src/EventStore.Core/TransactionLog/Chunks/TFChunkReader.cs:line 82

   at EventStore.Core.Services.Storage.ReaderIndex.AllReader.ReadAllEventsForwardInternal(TFPos pos, Int32 maxCount, Int32 maxSearchWindow, IEventFilter eventFilter) in /home/runner/work/TrainStation/TrainStation/build/oss-eventstore/src/EventStore.Core/Services/Storage/ReaderIndex/AllReader.cs:line 79

   at EventStore.Core.Services.Storage.ReaderIndex.AllReader.ReadAllEventsForward(TFPos pos, Int32 maxCount) in /home/runner/work/TrainStation/TrainStation/build/oss-eventstore/src/EventStore.Core/Services/Storage/ReaderIndex/AllReader.cs:line 51

   at EventStore.Core.Services.Storage.ReaderIndex.ReadIndex.EventStore.Core.Services.Storage.ReaderIndex.IReadIndex.ReadAllEventsForward(TFPos pos, Int32 maxCount) in /home/runner/work/TrainStation/TrainStation/build/oss-eventstore/src/EventStore.Core/Services/Storage/ReaderIndex/ReadIndex.cs:line 91

   at EventStore.Core.Services.Storage.StorageReaderWorker.ReadAllEventsForward(ReadAllEventsForward msg) in /home/runner/work/TrainStation/TrainStation/build/oss-eventstore/src/EventStore.Core/Services/Storage/StorageReaderWorker.cs:line 366

EventStore details

  • EventStore server version: 21.6, running in docker
  • Operating system:
    linux docker
  • EventStore client version (if applicable):

@hayley-jean hayley-jean self-requested a review October 12, 2023 10:31
@lakshdeepsingheventstore lakshdeepsingheventstore force-pushed the lakshdeepsingh/Improve-error-message-when-starting-catchup-subs-on-allstream-far-beyond-last-known-commit-position branch 3 times, most recently from 42506c0 to 8c3672e Compare October 13, 2023 18:15
hayley-jean
hayley-jean previously approved these changes Oct 30, 2023
Comment thread src/EventStore.Core/Services/Transport/Grpc/Enumerators.AllSubscription.cs Outdated
@lakshdeepsingheventstore lakshdeepsingheventstore force-pushed the lakshdeepsingh/Improve-error-message-when-starting-catchup-subs-on-allstream-far-beyond-last-known-commit-position branch from 8c3672e to 75cda4e Compare November 6, 2023 14:44
@lakshdeepsingheventstore lakshdeepsingheventstore force-pushed the lakshdeepsingh/Improve-error-message-when-starting-catchup-subs-on-allstream-far-beyond-last-known-commit-position branch from 75cda4e to 17a71dd Compare November 6, 2023 14:57
@hayley-jean hayley-jean merged commit 018ef1a into master Nov 13, 2023
@hayley-jean hayley-jean deleted the lakshdeepsingh/Improve-error-message-when-starting-catchup-subs-on-allstream-far-beyond-last-known-commit-position branch November 13, 2023 10:08
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.

Unclear exception message when starting subscription far beyond starting point (EventStore.Core.TransactionLog.Chunks.TFChunk.InvalidReadException)

3 participants