зеркало из https://github.com/microsoft/statsd.git
Catch DNS errors from UDP socket
If repeater is used with hostnames rather than IPs a DNS resolution error crashes statsd server. If you have a chain of statsd servers configured to repeat data down the line this has the potential to bring down the entire chain. Attaching an error handler stops dgram socket from throwing an exception and instead logs to console
This commit is contained in:
Родитель
187697cd21
Коммит
a636fc2383
|
@ -7,7 +7,10 @@ function RepeaterBackend(startupTime, config, emitter){
|
|||
this.sock = (config.repeaterProtocol == 'udp6') ?
|
||||
dgram.createSocket('udp6') :
|
||||
dgram.createSocket('udp4');
|
||||
|
||||
// Attach DNS error handler
|
||||
sock.on('error', function (err) {
|
||||
console.log('Repeater error: ' + err);
|
||||
});
|
||||
// attach
|
||||
emitter.on('packet', function(packet, rinfo) { self.process(packet, rinfo); });
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче