Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-14486

Nginx + SSL does not work due to blocked socket

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      20211120-0.4.15-dev-3407-g9c4397a

      Description

      Easily reproducible:

      Follow the instructions as detailed here: A single HTTP/HTTPS server
      Then request https://127.0.0.1

      Nginx stops working because the socket is blocked, if you stops the page loading then Nginx starts working again.

      I took a trace with api monitor in windows XP, it is as follow:

      nginx.exe	WSASetLastError ( ERROR_SUCCESS )
      nginx.exe	WSASetLastError ( ERROR_SUCCESS )
      nginx.exe	recv ( 296, 0x0189695b, 16709, 0 )	37
      nginx.exe	WSASetLastError ( ERROR_SUCCESS )
      nginx.exe	recv ( 296, 0x0189695b, 16709, 0 )	SOCKET_ERROR	10035 = No se puede completar de forma inmediata una operaciĆ³n de desbloqueo de socket.
      nginx.exe	WSAGetLastError (  )	WSAEWOULDBLOCK
      nginx.exe	WSASetLastError ( ERROR_SUCCESS )
      nginx.exe	recv ( 296, 0x0189695b, 16709, 0 )	1061
      nginx.exe	ioctlsocket ( 296, FIONREAD, 0x01a6ff18 )	0
      nginx.exe	WSASetLastError ( ERROR_SUCCESS )
      nginx.exe	recv ( 296, 0x0189695b, 16709, 0 )	SOCKET_ERROR	10035 = No se puede completar de forma inmediata una operaciĆ³n de desbloqueo de socket.
      nginx.exe	WSAGetLastError (  )	WSAEWOULDBLOCK
      nginx.exe	WSASetLastError ( ERROR_SUCCESS )
      nginx.exe	send ( 296, 0x0188f90b, 213, 0 )	213
      

      So I added a couple of DPRINTs in recv() to see what's happening:

      @@ -58,10 +58,11 @@ recv(IN SOCKET s,
       
                   /* Return Provider Value */
                   if (Status == ERROR_SUCCESS)
                   {
                       /* Handle OOB */
      +                DPRINT("recv bytes received %lu\n", BytesReceived);
                       if (!(flags & MSG_PARTIAL)) return BytesReceived;
                       ErrorCode = WSAEMSGSIZE;
                   }
       
                   /* If everything seemed fine, then the WSP call failed itself */
      @@ -74,10 +75,11 @@ recv(IN SOCKET s,
               }
           }
       
           /* Return with an Error */
           SetLastError(ErrorCode);
      +    DPRINT("recv error code %d\n", ErrorCode);
           return SOCKET_ERROR;
       }
       
       /*
        * @implemented
      

      This patch leads to this log:

      (/dll/win32/ws2_32/src/recv.c:34) recv: 76c, 2, 1, 00ABFEF4
      (/dll/win32/ws2_32/src/recv.c:63) recv bytes received 1
      (/dll/win32/ws2_32/src/recv.c:34) recv: 76c, 0, 4145, 00946003
      (/dll/win32/ws2_32/src/recv.c:63) recv bytes received 552
      (/dll/win32/ws2_32/src/recv.c:34) recv: 76c, 0, 4145, 0094F1C3
      (/dll/win32/ws2_32/src/recv.c:63) recv bytes received 51
      (/dll/win32/ws2_32/src/recv.c:34) recv: 76c, 0, 4145, 0093BFB3
      (/dll/win32/ws2_32/src/recv.c:63) recv bytes received 1060
      (/dll/win32/ws2_32/src/recv.c:34) recv: 76c, 0, 4145, 0093BFB3
      

      Then it stops until either I stop page loading in browser, or kill nginx.exe. In both cases we never reach the send() call.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bug zilla Bug Zilla
                Reporter:
                Julcar Julcar
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: