Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rsyslog.prototype.log() file descriptor leak using protocol U (UDP) #5

Open
syndr0m opened this issue Aug 21, 2014 · 1 comment
Open

Comments

@syndr0m
Copy link

syndr0m commented Aug 21, 2014

Rsyslog.prototype.log = function (level, msg, meta, callback) {
(...)
client.send(_buffer, 0, _buffer.length, this.port, this.host, function(err, bytes) {
      if (err)
      {
        // Should call client.close() before throwing error.
        // (can be a DNS error)
        throw err;
      }
(...)

simplified example of using udp socket.send() without close()

marc@marc:~/tmp$ cat > udp.js
for (var i = 0; i < 5; ++i) {
  require('dgram').createSocket("udp4").send(new Buffer("toto"), 0, 4, 4242, "127.0.0.1", function () { });
}
marc@marc:~/tmp$ node udp.js &
[1] 27644
marc@marc:~/tmp$ sudo lsof -n -i -P | grep node
node      27644      marc    9u  IPv4 8889835      0t0  UDP *:60787 
node      27644      marc   10u  IPv4 8889836      0t0  UDP *:60167 
node      27644      marc   11u  IPv4 8889837      0t0  UDP *:34401 
node      27644      marc   12u  IPv4 8889838      0t0  UDP *:58187 
node      27644      marc   13u  IPv4 8889839      0t0  UDP *:38581
@markstos
Copy link

This looks very related to #8 which suggests that winston-rsyslog is making a new TCP connection for each logging event when a single persistent connection might do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants