Closed tjaskula closed 5 years ago
Wouldn't changing the collection type to concurrent be the fix?
This may be a fix, but I wanted to check first if something else is not a cause of this exception and if multiple threads here is a normal behavior.
The idea behind TestWorld is that actors created directly through it are wrapped by TestActor and have synchronous delivery. The TestMailbox records (tracks) all messages delivered through it into a HashMap, which is not a concurrent capable collection. Thus I would say that it should be "impossible" to get concurrent access here, but I don't know the semantics of your TestActor instances and whether there are threads/tasks effecting async access around the TestActors/TestMailbox. To do so is officially incorrect use of these facilities, but again your socket readers might cause this. I don't know.
@tjaskula will look into it and give you an explanation of why it is happening or why it shouldn't happen.
@zpbappi thanks, I'll have a look this evening as well.
@zpbappi this seems to me like it was a side effect of the code I had. It's hard to explain but now when the underlying code is fixed I cannot reproduce this error. I consider this is not a valid bug anymore. But at least I have an explanation from @VaughnVernon what was the idea behind TestWorld
I'm not sure if the real problem is in TestKit but this exception I had while testing in
Vlingo.Wire
. Needs to be investigated. @zpbappi if you have some suggestions I would be grateful here.