[Mono-list] HttpWebRequest concurrency issues
ian.norton-badrul at thales-esecurity.com
Tue Dec 18 08:38:32 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
On 17/12/12 21:16, Esben Laursen wrote:
> I have seen a problem where mono would close a connection after the
> http request/response was done, it didnt break anything it just
> initiated a new session on every request even though it should use
> the same (it works on Windows). I have just recently upgraded on of
> my "test" machines to 3.0.1 (running CentOS, compiled from
> As far as I can tell, its the same problem on 2.6.x and 3.0.1. So
> if you find otherwise please speak up, as I would be really
> Now this being said, I have not yet done much work in this area of
> the code, the reason I upgraded was I was hitting a memory leak in
> the 2.6.x code (as far as I can tell)..
> I usually have 10 threads that do HTTP POST to send some text back
> to a server. I would like for it to use the same session again and
> again (or 10 sessions) in this case, but it closes after every POST
> (or GET for that matter)
It just goes to show that I should read these emails more before
replying to them.
I'm using my pmono build ( mono 3.0 ) and see the same things.
Basically, every WebRequest object with the same server address I
create ( and also dispose ) will subsequently re-use the same TCP
socket to my webserver. I'm all for re-using existing HTTP
connections but this seems very odd behavior especially given I
dispose the object.
This is easy to reproduce (I'm actually seeing it underneath the
JayRock JSON RPC client which extends WebRequest).
So.. what I see is:-
..that web requests using separate objects one after another always
re-use the HTTP conneciton unless the server has closed the socket.
..often any request made in parallel to the same address fails with a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
-----END PGP SIGNATURE-----
More information about the Mono-list