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) (#4308)

Co-authored-by: Petri Kero <[email protected]>
  • Loading branch information
Aaronontheweb and petrikero authored Mar 10, 2020
1 parent ab76895 commit 8850f8d
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 @@ -176,7 +176,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 @@ -60,6 +60,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 @@ -312,6 +317,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 @@ -547,6 +562,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 8850f8d

Please sign in to comment.