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

fix(test): Avoid EPIPE error in "web-ext sign" test #1346

Merged
merged 1 commit into from
Jul 16, 2018

Conversation

Rob--W
Copy link
Member

@Rob--W Rob--W commented Jul 16, 2018

In our fake AMO server, we are immediately sending a response without consuming the HTTP request body. This code pattern is known to cause EPIPE failures (see nodejs/node#12339). The fix is to consume the request body before responding.

Minimal local reproduction (tested with Node.js v10.6.0):

path/to/web-ext/tests/functional/fake-amo-server.js
$ node -e 'require("http").request({port:8989,method:"POST"},res=>{console.log(res.statusCode); res.pipe(process.stdout)}).end("x".repeat(1E7))'
200
{"url":"http://localhost:8989/validation-results/"}events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at WriteWrap.afterWrite [as oncomplete] (net.js:835:14)
Emitted 'error' event at:
    at Socket.socketErrorListener (_http_client.js:382:9)
    at Socket.emit (events.js:182:13)
    at onwriteError (_stream_writable.js:431:12)
    at onwrite (_stream_writable.js:456:5)
    at _destroy (internal/streams/destroy.js:40:7)
    at Socket._destroy (net.js:605:3)
    at Socket.destroy (internal/streams/destroy.js:32:8)
    at WriteWrap.afterWrite [as oncomplete] (net.js:837:10)

After this patch, the above error does not occur any more. I have also verified that GET requests also complete successfully.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 3b560fd on Rob--W:bye-bye-EPIPE into 4134812 on mozilla:master.

1 similar comment
@coveralls
Copy link

coveralls commented Jul 16, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 3b560fd on Rob--W:bye-bye-EPIPE into 4134812 on mozilla:master.

@rpl
Copy link
Member

rpl commented Jul 16, 2018

@Rob--W the change looks great, and that was also my guess.

Let's merge this! \o/

👋 "bye bye EPIPE error" ;-)

@rpl rpl merged commit bc4eb1c into mozilla:master Jul 16, 2018
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

Successfully merging this pull request may close these issues.

3 participants