Mike,
Post by Michael K. O'NeillPost by Roman Ryl...A rather simple stress application receives 10093 (WSANOTINITIALISED)
"Successful WSAStartup not yet performed" and then
ERROR_OUT_OF_MEMORY errors on server side which I believe this to be a
winsock bug. There is source code and description at
http://alax.info/blog/130
The question is: Is there a simple way to report this to Microsoft?
Maybe there is something easier than described here
http://weblog.timaltman.com/node/834I spend 10 minutes looking for a
submission method on MS website and I failed.
RomanYour server code starts a new thread for each and every connection. Very
poor scalability. Your code is probably failing in the call to
CreateThread(), which is one of the few calls whose return value you don't
check.
At what number of connections do you see the errors? If you are getting
several hundred or up to a thousand or so, before errors, then you are
probably seeing the best performance you could possibly get with the
one-thread-per-connection architecture.
Performance is out of question here: yes it is poor but the code shows
the problem. The problems comes sooner or later depending on a number
of threads and connection lifetime - with the values hardcoded in the
project I typically get:
1. Client - approximately 50 "10054 WSAECONNRESET" errors followed by
20 "10061 WSAECONNREFUSED" errors (server socket already inaccessible)
and a message
Summary: nElapsedTime 35969 ms, g_nConnectSuccessCount 3493
That is this happens in 36 seconds of execution. On the client it's all
right, quite expectedly.
2. Server - 2019 "10093 WSANOTINITIALISED" errors followed by messages
Error: Thread 9696, Error Code 0x8007276d (10093) // 2019 times for
different threads
Error: Thread 1864, Error Code 0x80070008 (8)
Summary: g_nAcceptSuccessCount 3481, g_nConnectionSuccessCount 1473,
g_nConnectionFailureCount 2019
This is where it goes unexpected. At some point server sockets
(starting in this run from 1474th or so) are not reported to be closed
and freeze until entire server side socket subsystems gives
WSANOTINITIALISED for all currently opened sockets and error 8 (out of
memory) is reported for listening socket. It looks like on server side
sockets crash, get memory corrupted or whatever. Sockets get
uninitialized by themselves.
Thus good or bad the performance is, server side sockets fail to serve
connections at some moment (looks like at the moment system runs out of
available anonymous sockets).
Roman
BTW CreateThread result is checked