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

EventEmitter memory leak on redirect #1390

Closed
blakeembrey opened this issue Jan 30, 2015 · 7 comments
Closed

EventEmitter memory leak on redirect #1390

blakeembrey opened this issue Jan 30, 2015 · 7 comments
Labels

Comments

@blakeembrey
Copy link
Contributor

I was debugging serviejs/popsicle#10 and found out that there's actually an event listening bug that occurs on every redirect. It keeps attaching the same pipe and end event listeners every redirect.

I'll try to get a PR with tests ASAP, but didn't want this to get lost.

The referenced issue is somewhat related to #1132 since it hits an infinite redirect on 302 which made this fun to debug. FWIW, curl did not get stuck in an infinite redirect (maybe another PR) and correctly closed.

> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: example.com
> Accept: */*
> 
< HTTP/1.1 302 Found
< Date: Fri, 30 Jan 2015 15:12:52 GMT
* Server Apache/2.2.15 (Red Hat) is not blacklisted
< Server: Apache/2.2.15 (Red Hat)
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Location: http://example.com
< Content-Length: 107
< Connection: close
< Content-Type: text/html; charset=utf-8
< 
* Closing connection 0
<html><head><meta http-equiv="refresh" content="0;url=http://example.com"/></head></html>
@nylen
Copy link
Member

nylen commented Jan 30, 2015

👍

Have a look at #1329, that was a decent start but it appears to have been abandoned.

Infinite redirects are always fun :( if you can post the URL/status transitions the request goes through in a separate issue then we can take a look.

@blakeembrey
Copy link
Contributor Author

@nylen It literally just gets stuck in a 302 loop on itself (server that keeps trying to delete a cookie). Curl closes this. Anyway, I'll look at making another PR if that one has stagnated since this should have been caught by tests too (swear it worked before).

@nylen
Copy link
Member

nylen commented Jan 30, 2015

Do we let it delete the cookie?

I had another thought on #1132 which I'm posting there.

@blakeembrey
Copy link
Contributor Author

@nylen I'll check that in the morning, but my hunch is that might be the issue too. I'd guess that the header isn't updated each redirect since the request never ends.

@jpettitt
Copy link

jpettitt commented Oct 6, 2016

Did this ever get resolved? I just hit the issue.

Does the memory get reclaimed when the maxRedirects triggers and the request fails? I noticed it becasue my max event listeners is set to 10 and maxRedirects was set to 20 which cause a fatal, and uncatchable, error that killed the process. I've reduced my maxRedirects as a work around but I'd like to be sure I've not just created a memory leak.

@stale
Copy link

stale bot commented Nov 23, 2018

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 Nov 23, 2018
@stale stale bot closed this as completed Dec 2, 2018
@kevinburkenotion
Copy link

Read here to figure out why this is happening #3139 (you should be fine)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants