Skip to content

Commit

Permalink
Fix IActorRef leaks in AddressTerminatedTopic when entity terminates …
Browse files Browse the repository at this point in the history
…immediately after unwatching a remote actor. (#4305)
  • Loading branch information
petrikero authored Mar 9, 2020
1 parent c0cec03 commit 9f2948a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/Akka/Actor/ActorCell.DeathWatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ protected void TellWatchersWeDied()
}
finally
{
_state = _state.ClearWatching();
MaintainAddressTerminatedSubscription(() =>
{
_state = _state.ClearWatchedBy();
});
}
}

Expand Down
26 changes: 26 additions & 0 deletions src/core/Akka/ActorState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ internal interface IActorState
/// <returns>TBD</returns>
IActorState ClearWatching();
/// <summary>
/// Clears the `WatchedBy` set
/// </summary>
/// <returns>TBD</returns>
IActorState ClearWatchedBy();
/// <summary>
/// Clears the `Termination queue` set
/// </summary>
/// <returns>TBD</returns>
Expand Down Expand Up @@ -308,6 +313,16 @@ public IActorState ClearWatching()
return this;
}

/// <summary>
/// TBD
/// </summary>
/// <returns>TBD</returns>
public IActorState ClearWatchedBy()
{
_watchedBy = null;
return this;
}

/// <summary>
/// TBD
/// </summary>
Expand Down Expand Up @@ -536,6 +551,17 @@ public IActorState ClearWatching()
}


/// <summary>
/// TBD
/// </summary>
/// <returns>TBD</returns>
public IActorState ClearWatchedBy()
{
_watchedBy.Clear();
return this;
}


/// <summary>
/// TBD
/// </summary>
Expand Down

0 comments on commit 9f2948a

Please sign in to comment.