Open fdbeirao opened 5 years ago
This seems to be a duplicate of #2026. Hopefully I have provided a simpler way of reproducing the error.
Dupe of #2026
@fdbeirao thanks for helping me validate #3770 though!
I think this issue should be re-opened, as can be seen from the stacktrace embedded in the issue text, after applying #3770 . The actual cause of both #2026 and this issue surfaces. When using the CallingThreadDispatcherConfigurator
the thread safety provided by:
private readonly ConcurrentDictionary<string, Lazy<PluginHolder>> _pluginExtensionIds = new ConcurrentDictionary<string, Lazy<PluginHolder>>();
in Persistence.cs
breaks down into an infinite recursion that Lazy
guards itself against by throwing the InvalidOperationException
. @fdbeirao and I were trying to come up with fixes for this issue but failed so far. What we tried:
Lazy<PluginHolder>
with PluginHolder
in the above declaration (and fix the resulting errors)AdaptersFor
and ConfigFor
add e.IsValueCreated &&
in the condition of the FirstOrDefault
, this results in the ArgumentException($"Unknown plugin actor {journalPluginActor}")
surfacing on lots of places in client code.Can you create a reproduction test first and work backwards from that?
I've tried to add a failing test, see here, however suprisingly this test passes. When debugging it with break on all exceptions I can observe the InvalidOperationException
in the test however this is caught in ActorCell.SysMsgInvokeAll
. @Aaronontheweb Do you have any idea what causes the test to behave differently? I've ruled out target framework as an option for the difference. A variation of @fdbeirao s gist using the net452
framework still produces the exception.
I've tried to add a failing test, see here, however suprisingly this test passes. When debugging it with break on all exceptions I can observe the InvalidOperationException in the test however this is caught in ActorCell.SysMsgInvokeAll
Tell-tale sign of a Heisenbug. I think the best place to start is to review the faulty code first and understand what's happening there.
Akka.Net version: 1.3.12 Platform: Windows (.net core)
When creating a PersistentActor, while using the
CallingThreadDispatcherConfigurator
, we can observe aNullReferenceException
, and the actor doesn't get created.The minimal code to reproduce this issue is available here.
If we apply #3770, we can see that the exception is no longer a NullReferenceException, but instead a more "useful" exception: