Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/core/Akka.Streams/Stage/GraphStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1297,10 +1297,25 @@ public void InternalOnDownstreamFinish(Exception cause)
{
try
{
if (cause == null)
throw new ArgumentException("Cancellation cause must not be null", nameof(cause));
if (_lastCancellationCause != null)
throw new ArgumentException("OnDownstreamFinish must not be called recursively", nameof(cause));

// Some stages might propagate null exceptions due to improper Task continuation handling
// (see https://github.com/akkadotnet/Akka.Persistence.Sql/issues/498)
// This is a stop gap solution to make sure that Akka.Streams doesn't behave improperly
// until we can fix all of those
Comment on lines +1303 to +1306
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Document the reason in the code for future developers

Copy link
Member

Choose a reason for hiding this comment

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

LGTM

if (cause is null)
{
try
{
throw new DownstreamCompletedWithNoCauseException();
}
catch (DownstreamCompletedWithNoCauseException e)
{
cause = e;
}
}

_lastCancellationCause = cause;
CancelStage(_lastCancellationCause);
}
Expand Down
Loading