Oleh Derevenko(deleted)
|
TCP stream socket send() thread safety
|
Oleh Derevenko(deleted)
11/29/2007 5:58 AM
post3079
|
TCP stream socket send() thread safety
Hello
Sorry if I've chosen a wrong forum and/or if my story is not a priority at this time but I would like to attract some
more attention to the problem.
So, few years ago I had a problem PR24873 reported regarding socket send() function usage. If there were several
provider threads sending data blocks over a single socket, those blocks might arrive to receiver with data intermixed.
That is, the data transfer was not atomic. I worked the problem around by locking a mutex around send() invocation.
After a year and something I was happy to find my PR in resolved list of one of cumulative pre-SP3 patches (patch 234).
Naturally, my support plan was expired till that time already.
Well, I removed the mutex and the data did not intermix any more. However a new problem appeared. When program was
launched and there were numerous data transfers from multiple threads whole networking subsystem stalled. Only few data
blocks could go through and the receiver detected a timeout of 10 seconds! and disconnected. Then after some delay it
tried to reconnect, initiated startup once again and the same story was repeated over and over. Only after 10-15 minutes
system could stabilize and transit to normal functioning. However if there were load peaks later at runtime the
scenario with networking denial of service and disconnects-reconnects could repeat.
Obviously, the patch was not that good. Perhaps somebody blocked too much code with a mutex and introduced a bottleneck.
But since I did not have a support plan any more, my further letters were happily ignored. So I had to sigh and
uncomment my mutex around send() again. This is the way I'm running it till this time in "fast, robust and reliable
operating system".
So, if you are now doing active development in networking area, maybe somebody would take a look at this issue (if the
code has not been completely rewritten yet, of course)?
|
|
|