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

.end should not be called on already handled http responses #485

Open
mitsos1os opened this issue Dec 27, 2020 · 2 comments
Open

.end should not be called on already handled http responses #485

mitsos1os opened this issue Dec 27, 2020 · 2 comments

Comments

@mitsos1os
Copy link
Contributor

mitsos1os commented Dec 27, 2020

Steps to reproduce

Every response that contains plain API data (not file download, binary, etc...), is ended twice.

  1. from operationResults.sendBody
  2. explicitly calling .end on the response one line below

Current Behavior

On NodeJS versions >= 13.8.0 the internal NodeJS behavior of response handling has changed (see relevant NodeJS issue), leading to hanging requests. I have a local dev environment where a Loopback v3 API is run, contaning also the middleware for static-file serving. Every file request that happens to re-use a socket that was ended twice from the above mentioned lines, hangs.

Expected Behavior

The requests should complete successfully.

Versions prior to v13.8.0 have a response handling mechanism that is not affected by multiple .end on a socket instance. I believe this is also a bug in NodeJS, that is also I opened the issue there.

However, I also believe double ending the response is a bad practice, since res.json that is called from sendBodyJson terminates the response itself, without the need to explicitly .end the response one line below.

Additional information

linux x64 14.15.3
loopback@3.25.1

Related Issues

None

@mitsos1os mitsos1os added the bug label Dec 27, 2020
@mitsos1os
Copy link
Contributor Author

I know that officially strong-remoting is EOL. If you are willing to accept this issue, I would be happy to issue a PR for it

@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant