Dispose and DataReceiver Task race condition in WatsonTcpClient #232
fisherman6v6
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Joel,
I noticed that sometimes inside the
DataReceiver
function even if a null check on_Client
is performed, anArgumentNullException
is thrown byBuildFromStream
. This is probably due to Dispose called in between theDataReceiver
Check-for-Connection and the subsequent functions call. The exception won't cause major troubles since it gets caught in the lastcatch
but I was wondering if this behavior is expected, or something can be improved.Just a quick overview of my use case where I noticed this behavior. I developed a sort of distributed Event Aggregator where actors can register to events and a daemon server will dispatch these various events in form of notifications to registered actors. So, the demon has an active WatsonTcpServer which receives register requests and notifications to be dispatched. It will dispatch these notifications to registered actors using a onetime WatsonTcpClient that will be disposed just after the notification has been sent. This seems to cause the race condition mentioned above.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions