i've been tinkering with the node.js bindings directly and have come
across an issue where i get a fatal exception thrown on a tcp_wrap
write operation when the buffer is not valid:

node: ../src/stream_wrap.cc:293: static v8::Handle<v8::Value>
node::StreamWrap::Write(const v8::Arguments&): Assertion
`Buffer::HasInstance(args[0])' failed.
Aborted

This is on 0.6.10.

I'm confused about the usage of assert everywhere in the c++ bindings
in the production release. shouldn't assert only be used in debug
mode? won't all these asserts hurt performance?

as a result of the assert, i don't seem to be able to catch the error
anywhere in uncaughtException handler or in SIG* handlers.

forgive me if it's a stupid question - i'm no c/c++ guru...

you can see the issue with the following script (assuming a server
listening on localhost:21):


var TCP = process.binding("tcp_wrap").TCP
var sock = new TCP();

process.on("uncaughtException", function(err) {
        console.error(err);
});

var r = sock.connect("127.0.0.1", 21);
if(!r) process.exit(1);
r.oncomplete = function(status, peer, req) {
  var wr = peer.write({});
  if(!wr) {
    peer.close();
        return;
  }
  wr.oncomplete = function(status, peer, req) {
    if(status != 0) {
          peer.close();
          return;
        }
        console.log("sent");
  }
};

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to