> Maybe what is neccessary is a thread to watch over the > connection pool and recycle a connection once the server > drops it. else its a problem with the client implementation, > if it opens many connections but never use them - the > underlying connection library should not get involved in such matters. >
I also think that the Conns should be added to the pool by the thread that creates them - ie. the thread that calls http.c/send_request(). Currently, they are added to the pool by http.c/handle_transaction() - ie. added when the client is handling the response. This allows the client to potentially make many requests to the same URL before handling the first response. This in turn means that lots of separate Conn instances are created to the same host/port before the first one is added to the pool. The exact sequence is really down to the thread scheduler; I think the code should be more explicit and add the Conn to the pool in the same thread that creates it. I'm not saying that the implementation is broken; just that its possible to cause descriptor starvation in a Kannel HTTP server relatively easily using a Kannel HTTP client.
<<winmail.dat>>
