mikeal/request — Issue #159: Requests freeze, timeouts do not work when make request through a proxy
Author: dpetukhov
Created: 2012-01-20 02:52:11+00:00
State: open

I found a danger bug in the library, which drive me crazy and calling a real headache for over a last week. At last I succeeded consistently reproduce the problem and present it to you. Look at this code:

https://gist.github.com/1644619

Here we start 1000 queries through request. I use async.queue (async module) for limit number of onetime running threads to 40 threads. Also I use list of 133 proxy: some of them duplicated, some of them non-working at all, but it is doesn't matter. When request ends, it calls callback() which start next task from the queue. When all requests done and queue is empty, drain function is called.

In theory, we should get 1000 callbacks from request - with error, timeout or without, it doesn't matter. But when I run script, I see every time 8-10 threads are frozen at the end. This means request in 8-10 cases doesn't call callback I have passed.
When I comment proxy line, all works fine.

Please help me with this issue.