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

socket emit 'error' twice #20418

Closed
ronag opened this issue Apr 30, 2018 · 8 comments
Closed

socket emit 'error' twice #20418

ronag opened this issue Apr 30, 2018 · 8 comments

Comments

@ronag
Copy link
Member

ronag commented Apr 30, 2018

I'm getting error emitted twice from the same object?

Version: v10.0.0
Platform: Darwin Roberts-MacBook-Pro-2.local 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64

Error: connect ECONNREFUSED 127.0.0.1:6020
  at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)

and

Error: read ECONNRESET
  at TLSWrap.onread (net.js:659:25) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }

Seems like a bug?

@addaleax
Copy link
Member

Seems like a bug?

I agree, if error is being emitted twice that’s a bug.

Can you provide the information from the issue template?

@ronag
Copy link
Member Author

ronag commented Apr 30, 2018

I don't have a reproducible case. Got this from the logs in our production servers.

@ronag
Copy link
Member Author

ronag commented Apr 30, 2018

I think it´s a TCPConnectWrap && TLSWrap issue where TCPConnectWrap destroy's itself with an error and then destroys the TLSWrap with an error and then forwards the TLSWrap error up the chain.

After TCPConnectWrap.destroy errors from TLSWrap should be swallowed, no?

@ronag ronag closed this as completed Apr 30, 2018
@ronag ronag reopened this Apr 30, 2018
@ronag
Copy link
Member Author

ronag commented Apr 30, 2018

This error does not occur in node 9. Just in node 10.

@ronag ronag closed this as completed Apr 30, 2018
@ronag ronag reopened this Apr 30, 2018
@ronag
Copy link
Member Author

ronag commented Apr 30, 2018

Node 10:

ERROR: upgrade failed
    proxyName: "nxt"
    req: {
      "method": "GET",
      "url": "/deepstream"
    }
    err: {
      "type": "Error",
      "message": "connect ECONNREFUSED 127.0.0.1:6020",
      "stack":
          Error: connect ECONNREFUSED 127.0.0.1:6020
              at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
      "errno": "ECONNREFUSED",
      "code": "ECONNREFUSED",
      "syscall": "connect",
      "address": "127.0.0.1",
      "port": 6020,
      "statusCode": 503
    }
ERROR: uncaught exception
    err: {
      "type": "Error",
      "message": "read ECONNRESET",
      "stack":
          Error: read ECONNRESET
              at TLSWrap.onread (net.js:659:25)
      "errno": "ECONNRESET",
      "code": "ECONNRESET",
      "syscall": "read"
    }

Node 9:

ERROR: session error
    err: {
      "type": "Error",
      "message": "read ECONNRESET",
      "stack":
          Error: read ECONNRESET
              at TLSWrap.onread (net.js:602:25)
      "errno": "ECONNRESET",
      "code": "ECONNRESET",
      "syscall": "read"
    }
ERROR: upgrade failed
    proxyName: "nxt"
    req: {
      "method": "GET",
      "url": "/deepstream"
    }
    err: {
      "type": "Error",
      "message": "connect ECONNREFUSED 127.0.0.1:6020",
      "stack":
          Error: connect ECONNREFUSED 127.0.0.1:6020
              at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
      "errno": "ECONNREFUSED",
      "code": "ECONNREFUSED",
      "syscall": "connect",
      "address": "127.0.0.1",
      "port": 6020,
      "statusCode": 503
    }

@ronag ronag changed the title net: socket calls destroy twice socket emit 'error' twice Apr 30, 2018
@ronag ronag closed this as completed Apr 30, 2018
@apapirovski
Copy link
Contributor

@ronag what did you end up finding out?

@ronag
Copy link
Member Author

ronag commented Apr 30, 2018

@apapirovski: the behaviour is different between node 9 and 10. Not quite sure how.

I was basically doing things wrong. I didn't expect to get an error after calling socket.end().

@addaleax
Copy link
Member

@ronag Maybe this is #20334?

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

3 participants