brudo commented on pull request #59: URL: https://github.com/apache/activemq-nms-amqp/pull/59#issuecomment-780246783
@Havret thanks for your comments. The issue is that when you hit that first await, on a thread that is currently in a synchronized block anywhere up the call stack, that is already an invalid condition that may lead to deadlocks (and has been observed doing so - assuming I identified the right root cause). I agree that Task.Run is not the most elegant way to resolve it, but it might be the right solution for patching 1.8.x. A more correct way, assuming this kind of synchronization is still required in 2.0.x, would be to change to use an async-friendly alternative such as a SemaphoreSlim wherever the synchronized statement appears. Then Task.Run would not be needed. I'd be willing to help with a change like that for 2.0.x as a separate PR. I don't see any locks of any kind in your Artemis-specific client, but putting the recovery loop in its own long-running task also provides a form of synchronization / coordination, as that Task will only be running on one thread at a time. I like that approach. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
