Home Bug Reports

Apache crash with Ice/PHP

ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
Hi,

I'm experiencing a problem under Windows using Ice+PHP where Apache is crashing after the following sequence of calls

$proxy = $ICE->stringToProxy($proxyString);
if ($proxy)
{
$proxy->ice_ping(); // Crashes here
}

but only if the server that the proxy string refers to has died and been restarted and hence no longer contains the servant that the proxy refers to - if the server is running then there is no problem with this at all.

The actual Apache crash happens in php5ts.dll having been called from php_ice.dll. I've also tried replacing the ice_ping() call with an ice_checkedCast() call and that gives exactly the same problem.

Any thoughts?

- Nigel Tyler.

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Could you perhaps copy/paste the stack trace of the crash?

    Cheers,
    Benoit.
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    Stack trace

    The stack trace from Apache is

    > php5ts.dll!019250b8()
    [Frames below may be incorrect and/or missing, no symbols loaded for php5ts.dll]
    php5ts.dll!019251b6()
    php_ice.dll!01e75758()
    php_ice.dll!01e76270()
    msvcrt.dll!75eb3525()
    msvcrt.dll!75eb34ef()
    msvcrt.dll!75eb3695()
    msvcrt.dll!75eb3ac5()
    msvcrt.dll!75eb3a56()
    msvcrt.dll!75eb390b()
    msvcrt.dll!75eb3881()
    ntdll.dll!775c5f79()
    ntdll.dll!775c5f4b()
    ntdll.dll!77599812()
    ntdll.dll!775c5dd7()
    kernel32.dll!75c4fbae()
    kernel32.dll!75c4fbae()
    kernel32.dll!75c4fbae()
    msvcrt.dll!75eb32ff()
    msvcrt.dll!75eb51ba()
    msvcrt.dll!75eb390b()
    msvcrt.dll!75eb3881()
    ntdll.dll!775c5f79()
    ntdll.dll!775c5f4b()
    ntdll.dll!77599812()
    ntdll.dll!775c5dd7()
    kernel32.dll!75c4fbae()
    kernel32.dll!75c4fbae()
    kernel32.dll!75c4fbae()
    ice33.dll!022f1b5c()
    ice33.dll!02339725()
    ice33.dll!0233df7c()
    stlport_vc646.dll!02018dc2()
    stlport_vc646.dll!020074fe()
    msvcrt.dll!75eb3525()
    msvcrt.dll!75eb34ef()
    msvcrt.dll!75eb3695()
    msvcrt.dll!75eb3ac5()
    msvcrt.dll!75eb3a56()
    msvcrt.dll!75eb390b()
    msvcrt.dll!75eb3881()
    ntdll.dll!775c5f79()
    ntdll.dll!775c5f4b()
    ntdll.dll!77599812()
    ntdll.dll!775c5620()
    kernel32.dll!75c59884()
    ntdll.dll!775c4810()
    mswsock.dll!75172a52()
    kernel32.dll!75c4fbae()
    kernel32.dll!75c4fbae()
    kernel32.dll!75c4fbae()
    libhttpd.dll!6ff22bbd()
    libhttpd.dll!6ff09786()
    libhttpd.dll!6ff0412f()
    libhttpd.dll!6ff04382()
    libhttpd.dll!6ff1c2ba()
    msvcrt.dll!75eb2599()
    msvcrt.dll!75eb26b3()
    kernel32.dll!75c5d0e9()
    ntdll.dll!775a19bb()
    ntdll.dll!775a198e()

    The actual error reported is

    The thread 'Win32 Thread' (0x3964) has exited with code 0 (0x0).
    Unhandled exception at 0x019250b8 in Apache.exe: 0xC0000005: Access violation reading location 0x00000018.

    Just as an experiment, I tried killing off the (Ice) server and refreshing the web page, which produced the expected communications exception. I then restarted the server and refreshed the page again - I was wondering if having detected a communication exception then a cache or whatever might have been flushed - but the exact same Apache crash happened again.

    Hope this helps!

    - Nigel.
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    A bit more information...

    I've been playing around a bit and have discovered that I get exactly the same symptoms (ie Apache crashes) if I deactivate the servant that the proxy refers to, so the problem doesn't seem to be only when the Ice server dies and is restarted...

    - Nigel.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Which Ice version do you use? Did you check the note in the top-level README.txt file of your Ice binary distribution about the default apache stack size? A small stack size could explain these crashes.

    Cheers,
    Benoit.
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    I did indeed change the stack size, the report I currently get from dumpbin is

    100000 size of stack reserve
    1000 size of stack commit

    One difference is that for my version of apache (Apache/2.0.63, built Jan 17 2008 22:58:29) the executable is called "apache.exe" rather than "httpd.exe" - I hope this reflects nothing other a change of naming convention?

    - Nigel.
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    Benoit,

    I forgot to mention that I'm using Ice-3.3.1-VC60.

    - Nigel.
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    Hi Benoit,

    And yet one further thing: I have just tried a simple standalone command line PHP client (ie. no Apache involved) and get exactly the same problem...

    - Nigel.
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Nigel,

    I tried to reproduce this situation in the following environment:
    • Windows XP
    • PHP 5.2.6
    • Ice 3.3.1 binary distribution for VC60
    I used the client in demophp/Ice/value for my tests and everything worked as I expected it to: the client receives ObjectNotExistException if the server is running but the servant is not active, and the client receives ConnectionRefusedException if the server is not running.

    For us to look into this issue any further, we would need a detailed description of your environment (i.e., versions of Windows and PHP), along with a small, self-contained example that reproduces the problem.

    Regards,
    Mark
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    Hi Marc,

    It does seem like it must be some sort of environmental issue. I'm running
    • Windows Vista (with all the latest service packs etc)
    • PHP-5.2.10 (binary distribution)
    • Ice 3.3.1 binary distribution for VC60

    The most significant difference would, on the face of it, seem to be the version of PHP (my 5.2.10 vs. your 5.2.6) but if the latter is still available from the PHP website then it's no longer a supported version. I don't suppose you have a version of ICE compiled for a later version of PHP do you?

    In the meantime I'll see if I can put together a small example than demonstrates the problem.

    Cheers,
    - Nigel.
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    Although the PHP extension in the Ice 3.3.1 installer was compiled against PHP 5.2.6, it should be binary-compatible with subsequent PHP 5.2.x releases. I've just replaced PHP 5.2.6 with 5.2.10 in my test environment and it also works without problems.

    Regards,
    Mark
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    I also don't have any problems using Vista with the same software configuration (Ice 3.3.1 VC6 + PHP 5.2.10).

    Mark
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    Hi Mark,

    Thanks for that - I am now investigating by stripping everything down to basics!

    - Nigel.
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    Mark,

    I really am a lost to explain this at the moment - I've been through and checked my PC's environment etc to try and remove anything that might be spurious, but to no avail.

    I'm going to have to get some sleep and think about this more!

    However, I do attach the minimal test system I've been using to reproduce the problem. It should be self explanatory, the server is implemented in Python (server.py), there is a client also written in Python (client.py) which acts as a sanity check, and there is a standalone PHP client which crashes if the "free()" call is left in.

    Cheers,
    - Nigel.
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Nigel,

    Your example worked correctly for me. Here's the output from the PHP client:
    > php -c php.ini -f demo.php
    Bob The Builder
    Fatal error: Uncaught Ice_ObjectNotExistException
       identity: e3377c0f-a90a-490d-b464-c6c7bd7a559b
          facet:
      operation: getName
      thrown in demo.php on line 14
    
    I'm afraid I don't have an explanation for the behavior you're seeing either.

    Regards,
    Mark
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    Hi Mark,

    Thanks for trying out the example, it's good to know that it can work!

    However, I am now completely stumped. I've spent the morning trying out various things, and have got nowhere.

    I installed php-5.2.6 as a sanity check but that made no difference. I have also tried running PHP with a very controlled environment and checked with the visual studio debugger to make sure it was using the DLL's I expected it to - which it was.

    The debugger has shown that the ICE runtime is raising the ObjectNotExist exception as expected, but it crashes when it returns to the PHP runtime.

    As I don't have a copy of VC60 I can't try building new versions with that, but I have built a version of PHP-5.2.10 using VC80, but can't get IcePHP compiled with that compiler (lots of problems with time types if I cheat and disable the Makefile check for VC60...)

    So I've really run out of options!

    Being able to build with either VC80 or VC90 seems to be the only way forward I can think of; Are you planning to enable IcePHP to be built against a (presumably later) version of PHP using this compiler?

    Cheers,
    - Nigel.
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Nigel,

    I've updated my Vista virtual machine with all Windows updates just to see if that caused a conflict, but your example still works correctly.

    One benefit of using a virtual machine is that it's a relatively clean installation, free of the cruft that typically accumulates on a development machine. Do you have another machine that you can try this on?

    Regards,
    Mark
  • ntylerntyler Member Nigel TylerOrganization: OCSLProject: Gateway to MIS system
    Hi Mark,

    Yes, there are machines - both virtual and physical - that I can try this on in the office, but in a sense it won't necessarily achieve much as I already know that this can work because you've proved it!

    And if I could reproduce the problem I still wouldn't be able to track it down which of course is why I'd like to be able to build from the code.

    I also get very nervous about problems that I can't fix and that only appear on one machine...

    Regards,
    - Nigel.
Sign In or Register to comment.