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

Question about the error event handler. #45

Open
sripberger opened this issue Apr 27, 2020 · 1 comment
Open

Question about the error event handler. #45

sripberger opened this issue Apr 27, 2020 · 1 comment

Comments

@sripberger
Copy link

Hi, great work on this. It seems much cleaner than koa-range and it's nice to see multipart support.

This is less of an issue and more of a question, or potentially a note that could be added to the docs, but I've been getting these connection reset errors trying to play videos from a node server using Chrome 81:

Error: write ECONNRESET
      at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)
      at handleWriteReq (internal/stream_base_commons.js:51:26)
      at writeGeneric (internal/stream_base_commons.js:143:15)
      at TLSSocket.Socket._writeGeneric (net.js:780:11)
      at TLSSocket.Socket._write (net.js:792:8)
      at doWrite (_stream_writable.js:441:12)
      at clearBuffer (_stream_writable.js:580:7)
      at TLSSocket.Writable.uncork (_stream_writable.js:336:7)
      at ServerResponse.OutgoingMessage.uncork (_http_outgoing.js:244:17)
      at connectionCorkNT (_http_outgoing.js:698:8)

This happens with every range request implementation I've tried, including both this and koa-range. Fortunately, it doesn't seem to be affecting playback at all.

I noticed you have an error event handler in your example that silences these, among others:

function httpError(error) {
  return /^(EOF|EPIPE|ECANCELED|ECONNRESET|ECONNABORTED)$/i.test(error.code);
}

// ...

// Listen error event
app.on('error', error => !httpError(error) && console.error(error));

So, my question is, what is the reasoning behind this, aside from just not clogging up logs with these things? Do we know why these are happening, and whether or not they might be a problem in a production environment?

It's been really hard to find information about this through either Google or Stack Overflow. Would you mind pointing me in the right direction, and maybe allowing me to add some notes about the answers I find to your README, for the sake of others?

@nuintun
Copy link
Owner

nuintun commented May 8, 2020

@sripberger

PR welcome~

The reason maybe: http_request_reusedsocket

This not a problem in a production environment, just need to do exception catching.

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

2 participants