views:

243

answers:

1

Hello,

I have an application which makes use of winsock. I/O part is handled on an other thread. And I am using blocking select method for sockets. But the point is that after 5-6 hours,my application gives 0xC00000FD exception, at the line of select function.

As far as I know, this exception occurs when there is recursion, or very large local variables. But neither of them is the case for me.

So do you have any idea why am I getting this exception? Or any ideas to discover what actually causes exception?

many thanks

EDIT 2:

Dear All, I am very sorry but since reproducing the case takes long time, I just realized that this has not solved the problem. Everything seems ok when stack overflow exception occurs at the line of select function.

I mean it is a server socket with a one client connected. So there is 2 socket in rset and 1 in wset. After selecting, I am checking all ready sockets and making required, read,write,accept. Timeout is 250 ms. Do you think can this be the problem? I don't want this function to be blocking so it is not null. But what will be the exact difference if I use {0,0}

An important hint is:
Same code was working without any problem, when client socket wasn't sending any data. But when I started sending some data from client to server this problem occured.
I am sure that there is no problem with FD_SETs and FD_CLRs, I mean when client was not sending only 1(server) socket was in rset and 1(client) was in wset.

Anyway I had a look a lot of samples, but it seems that there is not a difference.

Please see local variables screenshot below(I have deleted name of executable, since it is a commercial product) http://img192.imageshack.us/img192/1948/stackoverflow.jpg

And here is the call stack: ntdll.dll!7c90df3a()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] mswsock.dll!71a53c9c()
ntdll.dll!7c90d26c()
mswsock.dll!71a55f9f()
mswsock.dll!71a55974()
ws2_32.dll!71ab314f()

xyz.exe!vm_socket_select(vm_socket * hds=0x04c1fb84, int nhd=1, int masks=7) Line 230 + 0x1b bytes C
xyz.exe!ND::nd_socket::SocketThreadProc() Line 173 + 0x12 bytes C++
xyz.exe!ND::nd_socket::ThreadRoutineStarter(void * u=0x07d63f90) Line 332 C++
xyz.exe!_callthreadstartex() Line 348 + 0x6 bytes C
xyz.exe!_threadstartex(void * ptd=0x011a3ce8) Line 326 + 0x5 bytes C
kernel32.dll!7c80b713()

I am waiting for any advice. Many thanks

+3  A: 

Have you tried stopping your program in a debugger after some time running? Then take a look at the stack it might give you a hint.

Recursion doesn't mean one of your functions call itself endlessly, it can't be more tricky and involve several layers before it comes back where it started.

f4
Or just look at the stack at the time of the crash in a debugger.
Michael Burr
yes but it takes 5 hours :)
f4