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

response's close event not being triggered #8613

Closed
canastro opened this issue Sep 17, 2016 · 5 comments
Closed

response's close event not being triggered #8613

canastro opened this issue Sep 17, 2016 · 5 comments
Labels
http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests.

Comments

@canastro
Copy link

canastro commented Sep 17, 2016

  • Version: 7.0.0-pre
  • Platform: Darwin 15.2.0 Darwin Kernel Version 15.2.0: Fri Nov 13 19:56:56 PST 2015; root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
  • Subsystem: test, lib

While attending the code and learn in the Node Interactive at Amesterdam we we’re giving the task of cleaning up some of the unit tests to follow the latest guidelines.

In the file test/parallel/test-http-agent-destroyed-socket.js once I replaced:

response.once('close’, callback)

for

response.once('close’, common.mustCall(callback))

The unit tests started to fail with the following error message:

Mismatched <anonymous> function calls. Expected 1, actual 0.
    at IncomingMessage.response.on (/Users/ricardocanastro/dev/node/test/parallel/test-http-agent-destroyed-socket.js:48:37)

In order to simulate the issue I created the following gist:
https://gist.github.com/canastro/36ed5066d2516c425498884123cb0824
If you run this, you'll see that 'response:: close' never gets printed.

@mscdex mscdex added http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests. labels Sep 17, 2016
@addaleax
Copy link
Member

Am I understanding you correctly that the request1:: socket closed line in your gist doesn’t get printed?

@canastro
Copy link
Author

@addaleax nop, the 'response:: close' never gets printed. I'll add this information to the main comment to make it a bit clearer.

@addaleax
Copy link
Member

Yeah, I can confirm that. /cc @nodejs/http

@Trott
Copy link
Member

Trott commented Jul 10, 2017

@nodejs/http Confirmed bug? Not a bug? Something else?

@apapirovski
Copy link
Member

Fix to the test in #20006

@lpinca lpinca closed this as completed in 15e136d Apr 17, 2018
jasnell pushed a commit that referenced this issue Apr 17, 2018
A whole part of the test-http-agent-destroyed-socket test
was not running as the semantics of http events changed
slightly and were no longer triggering the expected event.
Instead listen to the same event on the socket to verify
that the code being tested is still working as expected.

PR-URL: #20006
Fixes: #8613
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants