-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExpectMsgAsync deadlocks with actor that has async receive handler and testprobe.Tell #7145
Comments
This is the only major TestKit change we made in v1.5.16 #7037 and it looks like you're not using Results with Akka.NET v1.5.16However, running your reproduction I did get this log out of the box:
And the test did indeed deadlock. Results with Akka.NET v1.5.15Test passed this time, but here's what's strange - I still get a
Looks like this is a bug with the |
Lost my original GH message due to my browser crashing, but I modified the using Akka.Actor;
using Akka.Event;
using AkkaTest.Messages;
namespace AkkaTest.Actors;
public class InitActor : ReceiveActor
{
private readonly ILoggingAdapter _logger = Context.GetLogger();
public InitActor()
{
ReceiveAsync<InitRequestMessage>(Handler);
}
private async Task Handler(InitRequestMessage initMsg)
{
_logger.Info("First step - Sender: {0}", Sender);
// Do something'
await Task.Delay(1);
Sender.Tell(new InitResponseMessage(), Self);
_logger.Info("Second step - Sender: {0}", Sender);
//await Task.Delay(1); // Uncomment this line to fix the test, with 1.5.15 works without uncomment
Sender.Tell(new StartRequestMessage(), Self);
_logger.Info("Third step - Sender: {0}", Sender);
}
} Akka.NET v1.5.16 ResultsHere's what is spooky:
We never hit the "third step" logging call - even weirder, none of the timeouts on Akka.NET v1.5.15 ResultsAdded a v1.5.15 branch here https://github.com/Aaronontheweb/Akka-Bug-Report/tree/1.5.15 and ran the results:
Works fine! So I'm left wondering, if the removal of the |
If I comment out all of the Things worked before because we had I think what we need to do here is fix the That being said, this should be a straightforward fix - I think we can probably just get rid of our |
I have checked the Akka.NET v1.5.16 notes and i'have seen this commit: 3fb9247 where the ConfigureAwait(false) has been removed
Thank you for your quick answer! |
I have a validated fix for this here: #7157 - I just need to clean up some of the other TestKit methods first before I ask for reviews. |
…Channel<T>` (#7157) * deleted `IAsyncQueue`; replaced with System.Threading.Channel * added reproduction for #7145 * fixed issues with `ExpectNoMsgAsync` and `ExpectNoMsg` * fixed issues with `TryPeekAsync` * added API approvals * removed contention spec * harden spec * fix warning --------- Co-authored-by: Gregorius Soedharmo <[email protected]>
Version Information
Akka.TestKit.Xunit2 1.5.16 and upwards (works with 1.5.15 and downward)
Describe the bug
ExpectMsgAsync/ExpectMsg in combination with tell on an actor with async receive handler that calls "Tell" on the test probe that triggered the handler.
To Reproduce
Steps to reproduce the behavior:
Link to the test project:
https://github.com/biasc/Akka-Bug-Report/tree/main
Expected behavior
Unit test should pass - no deadlock should occur.
Actual behavior
The unit test deadlocked.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Windows 11, net8.0
The text was updated successfully, but these errors were encountered: