And why do we fall, Bruce ? ...
"... So we can learn to pick ourselves up" (From Batman Begins). But it's a good line none the less. Especially when t comes to technology and computers.
I've run into a little problem while running my node.js irrigation control software. Every once in a while I get this:
events.js:66 throw arguments[1]; // Unhandled 'error' event ^ Error: getaddrinfo ENOENT at errnoException (dns.js:31:11) at Object.onanswer [as oncomplete] (dns.js:123:16) [1]+ Exit 1 node ./sched.js
While it's very descriptive in it's message (basically the getaddrinfo failed) it really doesn't tell me anything. I have no code file called events.js (part of node.js). So what does it mean? Well at first I couldn't figure it out. I suspected that it was a problem with the connection to the user (I'm using sockets). So I did a search and found vague references to the problem but no real answers. Until I came upon a bug report where support asked one simple question: "Do you have an 'error' listener set up on your connection instance?" (thanks mscdex for that). It was a 'Duh!' moment for me. I listen for a connect and disconnect (and a few other things) but not an error. So I added:
socket.on('error', function(){ --userCount; consolelog("Socket error"); consolelog("Error from " + address.address + ":" + address.port + "(" + userCount + ")"); if(userCount < 0) { userCount = 0; } });
So far it hasn't occurred again, which doesn't mean that it won't but I am hopeful. At the moment I am in the middle of setting and relearning how to use Eclipse. I'm making the effort so I can use Eclipse to debug node.js programs as well as some of my embedded stuff. I don't expect that I will totally give up on emacs as I'm always using that but I expect I'll be using Eclipse a lot more with my work so it's best to get adjusted to the environment now.
1 Comments:
Well I came home today to another Unhandled event so I can say that it wasn't the socket.io where I needed to catch the event (still it should be caught). So that leaves one other spot in my code, the UDP handler. I've added this code:
this.client.on("error", function (err) {
consolelog("UDP error: " + err);
});
Hopefully this will resolve this issue.
Post a Comment
<< Home