title: Stack Overflow exception (0xC00000FD) at winsock select function
body: <p>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. </p>
  
  <p>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.</p>
  
  <p>So do you have any idea why am I getting this exception?
  Or any ideas to discover what actually causes exception?</p>
  
  <p>many thanks</p>
  
  <p>EDIT 2:</p>
  
  <p>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.</p>
  
  <p>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} </p>
  
  <p>An important hint is:
  <strong><br>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.</strong>
  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.</p>
  
  <p>Anyway I had a look a lot of samples, but it seems that there is not a difference.</p>
  
  <p>Please see local variables screenshot below(I have deleted name of executable, since it is a commercial product)
  <a href="http://img192.imageshack.us/img192/1948/stackoverflow.jpg" rel="nofollow noreferrer">http://img192.imageshack.us/img192/1948/stackoverflow.jpg</a></p>
  
  <p>And here is the call stack:
  ntdll.dll!7c90df3a()<br>
      [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
      mswsock.dll!71a53c9c()<br>
      ntdll.dll!7c90d26c()<br>
      mswsock.dll!71a55f9f()<br>
      mswsock.dll!71a55974()<br>
      ws2_32.dll!71ab314f()   </p>
  
  <blockquote>
    <p>xyz.exe!vm_socket_select(vm_socket * hds=0x04c1fb84, int nhd=1, int masks=7)  Line 230 + 0x1b bytes C<br>
        xyz.exe!ND::nd_socket::SocketThreadProc()  Line 173 + 0x12 bytes    C++<br>
        xyz.exe!ND::nd_socket::ThreadRoutineStarter(void * u=0x07d63f90)  Line 332  C++<br>
        xyz.exe!_callthreadstartex()  Line 348 + 0x6 bytes  C<br>
        xyz.exe!_threadstartex(void * ptd=0x011a3ce8)  Line 326 + 0x5 bytes C<br>
        kernel32.dll!7c80b713()     <br></p>
  </blockquote>
  
  <p>I am waiting for any advice.
  Many thanks</p>