Code Monkey home page Code Monkey logo

Comments (10)

AlexeyKupershtokh avatar AlexeyKupershtokh commented on May 14, 2024

+1 for this ticket. And I think it's about ECONNRESET too:

events.js:68
throw arguments[1]; // Unhandled 'error' event
^
Error: write ECONNRESET
at errnoException (net.js:769:11)
at Object.afterWrite (net.js:593:19)

from axon.

gjohnson avatar gjohnson commented on May 14, 2024

@visionmedia I am messing with this too, however it gets complicated. :-) Given that with EPIPE and ECONNRESET we did actually connect to the peer, but it broke mid-flight, meaning we did not fallback to enqueue(). Wondering if we should re-tweak a few things to have any sockets that need to buffer actually always enqueue messages and have them removed upon an "ack" message from the peer... Not all the different from keeping track of a "callback stack" with req/rep.

Anyhow, you can reproduce easily with larger messages that will be chunked, then close() the peer: gjohnson@233bc1c

from axon.

tj avatar tj commented on May 14, 2024

good point, hmMmM.. I'm seeing

    if (nbytes == -1 && (errno == ECONNRESET || errno == EPIPE ||
          errno == ETIMEDOUT))
        return -1;

in zmq's .write(), followed by the out_event():

    //  Handle problems with the connection.
    if (nbytes == -1) {
        error ();
        return;
    }

and

#if defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_FREEBSD
    //  Make sure that SIGPIPE signal is not generated when writing to a
    //  connection that was already closed by the peer.
    int set = 1;
    int rc = setsockopt (s, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof (int));
    errno_assert (rc == 0);

in the constructor, seems like they just bail on errors as well

from axon.

AlexeyKupershtokh avatar AlexeyKupershtokh commented on May 14, 2024

I think it's easy to handle at least in pub/sub: just drop the message being sent like the socket had been already shut down prior to error.

from axon.

tj avatar tj commented on May 14, 2024

yeah agreed that's definitely the easy case

from axon.

gjohnson avatar gjohnson commented on May 14, 2024

That commit I referenced would do that, I can pull... it will just hide errors on the other sockets as a side-effect, for now at least.

from axon.

tj avatar tj commented on May 14, 2024

sounds good, we might have to mock some node internals to get a reproducible test case, that one just hung for me

from axon.

AlexeyKupershtokh avatar AlexeyKupershtokh commented on May 14, 2024

Here's a js that stably reproduces such errors, just uncomment corresponding line:

var net = require('net');
var server = net.createServer(function(c) {
  c.write('hello\r\n');
  c.pipe(c);
});
server.listen(8124, function() {});

var client = net.connect({port: 8124}, function() { //'connect' listener
  //server.close(); // reproduces ECONNRESET
  var msg = 'world';
  client.write(msg);
  //client.destroy(); // reproduces EPIPE
});

from axon.

tj avatar tj commented on May 14, 2024

@AlexeyKupershtokh awesome thanks I will try that out in a minute

from axon.

tj avatar tj commented on May 14, 2024

just ended up sneaking in some faux errors

from axon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.