httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: svn commit: r735093 - /httpd/httpd/trunk/server/mpm/winnt/child.c
Date Wed, 21 Jan 2009 21:16:46 GMT
On 21.01.2009 18:33, William A. Rowe, Jr. wrote:
> William A. Rowe, Jr. wrote:
>> Rainer Jung wrote:
>>> Could be, that there's something wrong with the code that copies the
>>> listen sockets from the main process to the child.
>> Exactly; one of the primary possibilities is that a well documented API,
>> WSADuplicateSocket does not behave for a given socket provider.
>
> It's also possible that there is an [un]obvious bug.  I hate this particular
> tracing, but I'm off to check this out from the parent/child this afternoon.
> Yes - my own testing initially has been -X - it explains our discrepancy.

Looks like I solved it:

In r730828 Win9x code was removed. At least in one function, the Win9x 
code was kept and instead the more modern code was removed, namely in 
file mpm_winnt.c, function get_listeners_from_parent():

@@ -480,30 +466,12 @@
              exit(APEXIT_CHILDINIT);
          }

-        if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
-            HANDLE hProcess = GetCurrentProcess();
-            HANDLE dup;
-            if (DuplicateHandle(hProcess, (HANDLE) nsd, hProcess, &dup,
-                                0, FALSE, DUPLICATE_SAME_ACCESS)) {
...
-            }
-        }
-        else {
...
-            if (!SetHandleInformation((HANDLE)nsd, HANDLE_FLAG_INHERIT, 
0)) {
...
-            }
+        if (DuplicateHandle(hProcess, (HANDLE) nsd, hProcess, &dup,
+                            0, FALSE, DUPLICATE_SAME_ACCESS)) {
+            closesocket(nsd);
+            nsd = (SOCKET) dup;
          }
+
          apr_os_sock_put(&lr->sd, &nsd, s->process->pool);
      }

In effect, the "if" part is still there and the else part has been 
removed. As far as MSDN tells me, osver.dwPlatformId == 
VER_PLATFORM_WIN32_WINDOWS is true for Win9x, so the if part is the one 
to remove, and the else part is the one we might want to keep.

When I undo this change, it works again :)

By adding some logging, I see, that my XP system takes the else branch.

Regards,

Rainer

Mime
View raw message