Skip to content

Backport 1.5.59 fixes#8034

Merged
Aaronontheweb merged 11 commits intoakkadotnet:v1.5from
Aaronontheweb:backport/1.5.59
Jan 26, 2026
Merged

Backport 1.5.59 fixes#8034
Aaronontheweb merged 11 commits intoakkadotnet:v1.5from
Aaronontheweb:backport/1.5.59

Conversation

@Aaronontheweb
Copy link
Member

Cherry-picked fixes for 1.5.59 release from dev branch.

Included PRs

PR Title
#7986 Fix AwaitAssertAsync logic
#7988 CoordinatedShutdown: clearly log the reason why we're exiting
#7999 Fix DeferAsync async handler nesting bug in CommandAsync
#8005 Fix Inbox.AwaitResult throwing AggregateException instead of TimeoutException
#8006 Fix logger initialization continuation race in LoggingBus
#8011 Fix MergeSeen to filter Seen against current Members
#8018 Add BroadcastHub startAfterNrOfConsumers parameter
#7995 Add ActivityContext capture to LogEvent for trace correlation

Conflict Resolutions

  • API verification files for BroadcastHub: Added new Sink<T>(int startAfterNrOfConsumers, int bufferSize) overload
  • API verification files for LogEvent: Added ActivityContext property and changed setter visibility to protected set

Arkatufus and others added 8 commits January 26, 2026 13:56
…tnet#7988)

* CoordinatedShutdown: clearly log the reason why we're exiting

* fix log message
…7998) (akkadotnet#7999)

DeferAsync with an async handler threw "RunTask calls cannot be nested"
when called from within a CommandAsync handler after an await, when there
were no pending persist operations.

The fix removes the immediate RunTask execution optimization for async
handlers and always queues them to _pendingInvocations. This avoids the
nesting issue since the handler executes after the command handler
completes.

Added regression tests to verify the fix.
…xception (akkadotnet#8005)

* Fix Inbox.AwaitResult throwing AggregateException instead of TimeoutException

When FutureActorRef faults the task with a TimeoutException (via Status.Failure),
accessing task.Result would throw AggregateException instead of the expected
TimeoutException. This caused test assertions expecting TimeoutException to fail
intermittently when the internal Kick message timeout won the race against
task.Wait(timeout).

The fix checks task.IsFaulted after Wait() returns and properly unwraps the
exception before throwing, ensuring TimeoutException is thrown directly.

* Increase DeltaCount expectation timeout in DistributedPubSubRestartSpec

The default 3-second timeout was too tight for CI environments where
ActorSystem initialization timing can vary. Increased to 10 seconds
to provide more margin for the mediator to respond after a node restart.

* Revert "Increase DeltaCount expectation timeout in DistributedPubSubRestartSpec"

This reverts commit db14f2a.
…kkadotnet#8018)

Ports two fixes from Apache Pekko to resolve flaky BroadcastHub tests:

1. Add startAfterNrOfConsumers parameter (Pekko PR akkadotnet#275 by He-Pin)
   - Allows BroadcastHub to buffer elements until N consumers connect
   - Eliminates need for racy Task.Delay in tests

2. Fix race condition in consumer PostStop (Pekko PR akkadotnet#1841)
   - Only send UnRegister if offsetInitialized is true
   - Prevents StreamDetachedException when consumer detaches early

Both fixes are Apache 2.0 licensed from the Pekko project.
…#8006)

* Fix logger initialization continuation race in LoggingBus

StartDefaultLoggers was only waiting for the Ask task (logger ACK), not the
continuation that publishes "Logger started" message. This caused the
continuation to run during test teardown, triggering EventFilter assertions.

The fix returns the continuation task from AddLogger and uses
TaskContinuationOptions.ExecuteSynchronously to ensure the continuation
runs immediately when the Ask completes, before WaitAll returns.

* Add IsFaulted check for logger initialization

Handle the case where the Ask operation fails with an exception,
not just when it's cancelled. This ensures the logger is properly
removed and unsubscribed if initialization throws an exception.
…tnet#7995)

Captures Activity.Current?.Context at LogEvent creation time, enabling
downstream logging backends (like OpenTelemetry) to correlate logs with
their parent trace/span even after async dispatch through the actor mailbox.

This addresses GitHub issue akkadotnet#6855 where Activity.Current is lost when log
events cross actor mailbox boundaries due to AsyncLocal not flowing.

Changes:
- Add ActivityContext? property to LogEvent base class
- Capture context in constructor before mailbox crossing
- Add System.Diagnostics.DiagnosticSource package for netstandard2.0
- Add unit tests for trace context capture behavior
- Update API approval baselines

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>
akkadotnet#8011)

Apply defensive fix to MergeSeen that ensures the invariant
Seen ⊆ Members is always maintained. The merged seen set is
now intersected with current member addresses, preventing
stale entries from corrupting gossip state.

Closes akkadotnet#8009
@Aaronontheweb Aaronontheweb enabled auto-merge (rebase) January 26, 2026 20:08
Updates API verification files to reflect:
- BroadcastHub.Sink<T>(int startAfterNrOfConsumers, int bufferSize) overload
- LogEvent.ActivityContext property
- LogEvent property setters changed to protected set
Documents all 8 backported PRs for the 1.5.59 release including:
- Critical cluster gossip fix (akkadotnet#8011)
- Bug fixes for logging, inbox, persistence, and TestKit
- New features: ActivityContext capture and BroadcastHub improvements
- CoordinatedShutdown logging enhancement
Version and PackageReleaseNotes updated by build.ps1
@Aaronontheweb Aaronontheweb merged commit 85889e2 into akkadotnet:v1.5 Jan 26, 2026
6 of 11 checks passed
@Aaronontheweb Aaronontheweb deleted the backport/1.5.59 branch January 26, 2026 21:18
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.

2 participants