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

HTTP module can not call callback while same callback is running. #41182

Closed
hasinoorit opened this issue Dec 15, 2021 · 2 comments
Closed

HTTP module can not call callback while same callback is running. #41182

hasinoorit opened this issue Dec 15, 2021 · 2 comments

Comments

@hasinoorit
Copy link

hasinoorit commented Dec 15, 2021

Version

v16.13.1

Platform

Linux playground 5.11.0-41-generic #45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

HTTP

What steps will reproduce the bug?

var http = require("http")

http
  .createServer(function (req, res) {
    console.log("Req time: ", new Date())
    setTimeout(() => {
      res.write("Hello World!")
      res.end()
    }, 15000)
  })
  .listen(3000)

run this code. it will send response after 15 sec.
make a request and after 2-10 sec make 2nd request to the same url.
It will run the request call back after the 1st request is complete.

How often does it reproduce? Is there a required condition?

It can be reproduce any time.

What is the expected behavior?

It should accept the 2nd request and run the callback immediately.

What do you see instead?

2nd request callback is not firing while first request is not completed.

Additional information

If i send 3rd/4th or more request at the time when first request is pending. After the first request completion all request works as expected. But when all request are completed and we start these steps again, we see the same buggy output.

@Flarna
Copy link
Member

Flarna commented Dec 15, 2021

I'm not able to reproduce this if I run curl http://localhost:3000 in two separate shells.

I guess it's your HTTP client which queues the requests to the same host/port.
Which HTTP client do you use for the requests to above sample server?

@hasinoorit
Copy link
Author

@Flarna Thank you. it was my http client.

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