Hi David, My code looks like this:
1 while(1) 2 { 3 r = SSL_accept(m_ssl); 4 if (r > 0) 5 { 6 break; 7 } 8 r = ssl_retry(r); 9 if ( r <= 0) 10 { 11 break; 12 } 13 } The issue is not that it is going into an infinite while loop. The issue is that SSL_accept on line 3 never returns!. My socket is a non blocking one so as far as I know SSL_accept should return. A backtrace shows that when this happen the server gets stuck in: SSL_accept ssl23_accept ssl23_get_client_hello ssl23_read_bytes BIO_read sock_read __read_nocancel after calling SSL_accept. Thanks On Thu, Mar 20, 2008 at 11:44 AM, David Schwartz <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have setup an SSL server that works fine up to > > 400 connected clients. > > > When I try to have more then 400 clients, then my server hangs in the > > SSL_accept call.... This happens very randomly, sometimes beyond 1000 > > connected clients... > > > The server is dead once this happen and no other client can connect. > > > Please note that I am using non blocking sockets so SSL_accept _should_ > > return... but for whatever reason it does not. > > What is your code *supposed* to do if SSL_accept bails out of accept > immediately with EMFILE? If you keep looping and calling SSL_accept > forever, > then your code is going to loop forever. > > ret=accept(sock,(struct sockaddr *)&from,(void *)&len); > if (ret == INVALID_SOCKET) > { > if(BIO_sock_should_retry(ret)) return -2; > SYSerr(SYS_F_ACCEPT,get_last_socket_error()); > BIOerr(BIO_F_BIO_ACCEPT,BIO_R_ACCEPT_ERROR); > goto end; > } > > DS > > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager [EMAIL PROTECTED] >