-
Notifications
You must be signed in to change notification settings - Fork 118
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
Error: send 111 #19
Comments
@gdw2 can you paste the output of: |
Is this still an issue? |
I've found the same issue, for a different error, related when method connect is called. //Stack
events.js:72
throw er; // Unhandled 'error' event
^
Error: send -11
at errnoException (/usr/local/owner/project/node_modules/subProject/node_modules/winston-syslog/node_modules/unix-dgram/lib/unix_dgram.js:18:11)
at Socket.send (/usr/local/owner/project/node_modules/subProject/node_modules/winston-syslog/node_modules/unix-dgram/lib/unix_dgram.js:93:24)
at /usr/local/owner/project/node_modules/subProject/node_modules/winston-syslog/lib/winston-syslog.js:191:21
at Syslog.connect (/usr/local/owner/project/node_modules/subProject/node_modules/winston-syslog/lib/winston-syslog.js:253:9)
at Syslog.log (/usr/local/owner/project/node_modules/subProject/node_modules/winston-syslog/lib/winston-syslog.js:157:8)
at transportLog (/usr/local/owner/project/node_modules/subProject/node_modules/winston/lib/winston/logger.js:228:15)
at /usr/local/owner/project/node_modules/subProject/node_modules/winston/node_modules/async/lib/async.js:157:13
at _each (/usr/local/owner/project/node_modules/subProject/node_modules/winston/node_modules/async/lib/async.js:57:9)
at Object.async.each (/usr/local/owner/project/node_modules/subProject/node_modules/winston/node_modules/async/lib/async.js:156:9)
at Logger.log (/usr/local/owner/project/node_modules/subProject/node_modules/winston/lib/winston/logger.js:240:9) unix-dgram code of connect(): // FIXME defer error and callback to next tick?
if (err < 0)
this.emit('error', errnoException(err, 'send'));
else if (err === 1)
this.emit('congestion');
else if (typeof callback === 'function')
callback(); code: //
// Create the appropriate socket type.
//
if (this.isDgram) {
if (self.protocol.match(/^udp/)) {
this.socket = new dgram.Socket(this.protocol);
}
else if (self.protocol === 'unix') {
this.socket = require('unix-dgram').createSocket('unix_dgram');
}
else {
return this._unixDgramConnect(callback);
}
return callback(null);//Here, callback is called as if no error occurred, but no events handlers has been attached to socket yet.
} when protocol is equal 'unix', the socket is created without events handlers attached, so, all errors events from socket is throw as an Unhandled 'error' event. |
@jsbjair I'm confused, what protocol are you using: |
@santigimeno this.isDgram = /^udp|^unix/.test(this.protocol);
//
// Create the appropriate socket type.
if (this.isDgram) { /*...*/ } But, if you use unix(anything), the event handler is attached in ._unixDgramConnect(), |
Sorry, I don't follow :(. From what I read, the handling is different if you use |
if (!/^udp|unix|unix-connect|tcp/.test(this.protocol)) {
throw new Error('Invalid syslog protocol: ' + this.protocol);
} this test dont fail for "unix-dgram", so you can use any string beginning with unix. |
Ok, now I understand what you mean. Thanks. Let me check that |
@jsbjair what you say it's true, but if you use any different from |
@jsbjair anyway, the issue seems to be that there are uncaught errors when using |
yes |
here to throw if (!/^udp|unix|unix-connect|tcp/.test(this.protocol)) {
throw new Error('Invalid syslog protocol: ' + this.protocol);
} must be if (!/^udp$|unix$|unix-connect$|tcp$/.test(this.protocol)) {
throw new Error('Invalid syslog protocol: ' + this.protocol);
} |
Yes, you're right. I would welcome a PR fixing it :) |
As suggested by winstonjs#19
As suggested by winstonjs#19
I'm also observing the "Error: send -11" variant of this bug as mentioned in #19 (comment) I'm using version 2.4.4 of winston-syslog. Error -11 is EAGAIN, which means that some kind of throttling is going on. Regardless of the root cause, such an error should not propagate to the program that does logging. I am using protocol "unix" so the referenced PR seems not to have caused an effect. |
@gregoreesmaa I've put some time into investigating this issue lately. This is what I observed:
|
There's apparently an issue when logging to a congested socket. Why is this relevant? Because under load, any syslog implementation will eventually become congested. What's worse: winston's default behavior is to throw an exception. This means that applications are going to see sporadic failures. Neither Expected behavior:
Here's a test case (the "sender"):
To simulate a congested receiver, I execute the following This will block for the first 15 seconds and then start sending everything it reads to stdout. When executed with
|
Thanks for looking into this!
I don't completely agree, and have spent much of the past couple days on a problem with a non-Winston logger that is not logging everything it needs to, where the expected behavior is very much to bubble that error up, in this case all the way to a human user, to communicate that the content they think should've been logged wasn't logged successfully and a backup strategy should be invoked. However, I agree that if an app developer expects that behavior, they should be able to configure the logging library to behave that way, and the method of doing so should be well-documented. (I just don't think it should be the default, especially if it isn't currently.) I don't currently have the expertise and familiarity with unix-dgram (or even the relevant portions of winston-syslog) to go in and more deeply understand that interaction to get it working more smoothly, nor any funding to prioritize gaining that familiarity. However, I agree it does look like there's an issue here which could get fixed by someone with the appropriate expertise & motivation. |
Re: #19 (comment), I didn't look into how winston-syslog uses unix-dgram but after a "congestion" event you should pause until the next "writable" event. "congestion" is only emitted for connected sockets. For unconnected sockets you should just back off a bit and retry. It sounds like there's a bug in winston-syslog because that -9 error code is EBADF (bad file descriptor) and suggests it closed the socket while still using it. |
I'm getting an obscure "send 111" error when trying to log using the
unix
protocol. Any ideas? Thenode-syslog
package works fine, as does usinglogger
at the command line.The text was updated successfully, but these errors were encountered: