nats.net
nats.net copied to clipboard
SubscribeAsync does`t return control
Defect
Under pressue(many thread call publish method) sometimes method SubscribeAsync does`t return control to main program - somthing inside keeps control - no any exceptions and errors
Versions of NATS.Client
and nats-server
:
NATS.Client 0.14.6 nats-server 2.8.2
OS/Container environment:
docker from mcr.microsoft.com/dotnet/aspnet:latest
Steps or code to reproduce the issue:
Call SubscribeAsync
Expected result:
Get method result
Actual result:
Method does not return control to thread - freezing
Do you have any more information that could help us track this down?
Do you have any more information that could help us track this down?
Many thraeds sends data with Publish method very often, other thread make SubscribeAsync and if server memory usage near 90% - SubscribeAsync dont return to control flow
sample code - SubscribeAsync 3 and SubscribeAsync 4 does not fired in this case
server memory usage 80%
Same issue. Check your consumers count. If it's like 10K, it will timeout.
It's probably contention for locks for the publish queue. I would start working around this by spreading your publishing threads over more actual connections to the server, maybe even using a pool of connections. (if you are working in a cluster of servers, this will also help reduce the individual server load by spreading the connections to different servers.) Upping the pending limits should help some, in fact the defaults have been changed (increased) recently but are not the real issue here.