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

About the default HTTP client and socket hang up error #227

Closed
ttback opened this issue May 8, 2014 · 7 comments
Closed

About the default HTTP client and socket hang up error #227

ttback opened this issue May 8, 2014 · 7 comments

Comments

@ttback
Copy link

ttback commented May 8, 2014

I just read what you mentioned about overriding the default HTTP client 'cause it always brings up { [Error: socket hang up] code: 'ECONNRESET' } Error. How did you guys do it? I am doing something that requires me to go through a lot JSON docs in a queue with the request module and it is giving me a lot of { [Error: socket hang up] code: 'ECONNRESET' }

@domenic
Copy link
Contributor

domenic commented May 8, 2014

Sorry, what are you reading, and where?

@ttback
Copy link
Author

ttback commented May 8, 2014

I am asking about this part from Readme.md on Knox,

agent
Knox disables the default HTTP agent, because it leads to lots of "socket hang up" errors when doing more than 5 requests at once. See #116 for details. If you want to get the default agent back, you can specify agent: require("https").globalAgent, or use your own.

@domenic
Copy link
Contributor

domenic commented May 8, 2014

@ttback
Copy link
Author

ttback commented May 8, 2014

Is there something special for Node.js 0.12 that all these issues around request and http seem to be pointing to? I was looking at pooling http requests and there were some issues around the max listener error and socket hang up, and discussions all led to something like "this should not be an issue in node 0.12"

@domenic
Copy link
Contributor

domenic commented May 8, 2014

That's a good question. I know @isaacs was working on fixing them before heading over to work on npm full-time, although I never saw anything in the commit logs that conclusively said to me "this was the fix, it's all better now." Hard to be sure.

@ttback
Copy link
Author

ttback commented May 8, 2014

I was doing a simple util to expand short urls two weeks ago, https://github.com/ttback/node-expand-url and was baffled by warning: possible EventEmitter memory leak detected. 11 listeners added. related to Request Issue #311. With all those discussions on there, the solution I used ends up being var pool = new http.Agent({'maxSockets': Infinity}); and put it into the pool param for request. Based on your notes on Readme.md and the issue #116 discussion, using http.Agent at all is problematic, so I guess I need to copy your custom client code over to make these http calls work consistently.

@domenic
Copy link
Contributor

domenic commented May 8, 2014

Well, maybe. maxSockets: Infinity might work too? I know agent: false works well for us so far, but maxSockets: Infinity might be better in some way that hasn't showed up yet.

@domenic domenic closed this as completed Jun 11, 2014
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