ETIMEDOUT and ECONNRESET errors, might be because very short polling intervals
See original GitHub issueUsing node 0.12.5 and Azure SDK version 0.10.6.
Here’s a part of my code:
AzureServiceBus.prototype.onMessage = function(callback) {
var self = this;
if (this.isSubscribed) {
setInterval(function() {
self.connectionClient.receiveSubscriptionMessage(self.subscription, self.name, function(err, serverMessage) {
if (err && err == 'No messages to receive') {
return ;
} else if (err) {
console.log('Error'.red+' receiving Subscription Message from Azure ServiceBus');
console.log(err);
} else {
callback(serverMessage.body);
}
});
}, this.config.polling_interval < 50 ? 50 : this.config.polling_interval);
}
};
I come from a kafka developer background where I didn’t need to use polling to get new messages.
I usually get ECONNRESET error messages coming from that callback when the topic is active (receiving/writing messages). It doesn’t happen at the same place in my code (I have unit tests which fail in different points).
Sometimes I get ETIMEDOUT when first booting up my worker (it settles down after 3-5 errors like this).
Am I doing the setInterval thingy wrong ? If I increase the interval to 100 it doesn’t Error anymore but after a while some messages arrive delayed (the framework I’m working on must be real time, and I’m not willing to increase it further than 100).
Any other opinions on this ? Maybe Service Bus topics aren’t a good fit for this scenario at all.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top GitHub Comments
Thanks for the quick reply.
{ timeoutIntervalInS: 30 }
Helps but it doesn’t resolve the issue completely: I get ECONNRESET much less often (usually after I run my unit tests, like 3-5 of them).And another issue: memory usage is waaay too high: I have 5 workers and 1 API (on the same machine). When using Kafka as the messaging client I get around ~950 MB of total RAM usage. When using Azure I get around 2250 of total RAM usage (it doesn’t start at 2250, but it increases in a matter of seconds then stabilizes at that value). The machine’s RAM usage without any of these running is @ around 150 MB.
I don’t see any possible memory leakage from my code.
If you are using timeoutIntervalInS, is there any need to do your own interval? Or would you just run one request right after the last one completes? There is no docs on timeoutIntervalInS anywhere…what does it do??? Receive messages for x seconds, or just an abort timeout or what??