[Twisted-Python] Agent and "Cannot assign requested address"

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Fri Mar 4 08:33:11 EST 2011


On 01:29 pm, itamar at itamarst.org wrote:
>On Thu, 2011-03-03 at 21:00 -0700, Jason J. W. Williams wrote:
>>Hi All,
>>
>>I've got a situation where I'm using t.w.c.Agent to make 100,000 POST
>>request against a server. Each time a new Agent instance is built and
>>the request is sent using it. After about 20,000 requests, I get this
>>error:
>>
>>Failure: twisted.internet.error.ConnectError: An error occurred while
>>connecting: 99: Cannot assign requested address.
>>
>>Would building the Agent once and reusing the same instance avoid
>>this? I assume I've run out of client ports.
>
>Yes... except it doesn't support persistent connections yet. Do you
>actually need to run all 100,000 in parallel? If not, set a cap on how
>many requests can run in parallel.

It's worse than just "in parallel".  After the connection closes, it 
moves to TIME_WAIT for two minutes.  These count towards the limit as 
well.

Jean-Paul



More information about the Twisted-Python mailing list