Skip to content
  • Rob Swindell's avatar
    Set initial state of 'data_event' and 'highwater_event' to *not* signaled · 834d89ea
    Rob Swindell authored
    Since commit fd90eec6 (2 months ago), the Synchronet Web Server on
    my Windows systems has occasionally gone into a state where every HTTP session
    thread was causing 100% CPU utilization and each new HTTP session thread
    would just exacerbate the problem eventually leading to complete system
    instability/unresponsiveness until the sbbs instance was terminated. This was
    more readily reproducible on a Win7-32 VM, but would occasionally, though
    much less frequently, happen in a native instance on Win10-64 as well.
    
    Using the VisualStudio debugger, I was able to narrow it down to this:
    
    Each new HTTP thread (eventually, hundreds of such threads) would get stuck
    in this loop in http_output_thread():
    
        while(session->socket!=INVALID_SOCKET) {
    
    		/* Wait for something to output in the RingBuffer */
    		if((avail=RingBufFull(obuf))==0) {	/* empty */
    			if(WaitForEvent(obuf->data_event, 1000) != WAIT_OBJECT_0)
    				continue;
    			/* Check...
    834d89ea