Archived

This forum has been archived. Please start a new discussion on GitHub.

shutdown problem

Hi,
I always get a Segmentation fault when trying to execute shutdown from the php web page. The c++ client shutdown seems to work fine.
What am I doing wrong? How do I debug?

thanks,
Don

fragment of code in php web page:
$p = $ICE->stringToProxy("CUCard:tcp -p 10040:udp -p 10040");
$gcu = $p->ice_checkedCast("::CU::CUCard");
.....
$gcu->shutdown();

ice definition:
idempotent void shutdown();

shutdown routine in server:
void
CUCardI::shutdown(const Ice::Current & c) {
DataLog.add(SYS,SHUT,"Server Shutdown");
DataLog.close();
shutdown(c);
}

Comments

  • mes
    mes California
    Hi Don,

    You'll need to be more specific. In which program does the segmentation fault occur? Your server, or in the Web server where PHP is running?

    If a core file is being created, it would be very helpful to see the stacktrace from the fault.

    Finally, please provide your versions of Ice, PHP, Web server, compiler, and operating system.

    Take care,
    - Mark
  • shutdown segfault

    Hi,
    I'm continuing to debug the Segmentation fault. Attached are software versions and a traceback.
    Since I have seen some discussion of seg faults on mysql++, upon calling a distructor, I tried to rule that out by removing the Ice waitForShutdown call, thereby going directly to the database class distructors. They all run clean with a clean exit. Also, I think the traceback clearly shows the error is occuring in shutdown. It seems to not like c = 0, which I believe is the ctx. From php, calls, this parameter does not exist??
    Again, when I call server shutdown from a c++ client, it exits cleanly. Also, oddly to me,
    it seems to call shutdown many times. This trace continues with thousands of lines, all the same to CUCardI::shutdown.
    Any ideas, or how to further debug?

    thanks,
    Don

    Versions: Ice-3.0.1 IcePHP-3.0.1 Apache/2.2.0
    gcc version 3.3.5 (Debian 1:3.3.5-13)
    os Debian Sarge

    gdb trace:
    #10 0x40ddf8bc in std::ostream::operator<< () from /usr/lib/libstdc++.so.5
    #11 0x080cfa2e in Clogger::add (this=0x80e8780, facility=0, severity=9,
    message=@0x42ba2590) at ostream:199
    #12 0x0807a829 in CUCardI::shutdown (this=0x8111038, c=@0x0) at stl_alloc.h:652
    #13 0x0807a85b in CUCardI::shutdown (this=0x8111038, c=@0x0) at Server.cpp:136
    #14 0x0807a85b in CUCardI::shutdown (this=0x8111038, c=@0x0) at Server.cpp:136
    #15 0x0807a85b in CUCardI::shutdown (this=0x8111038, c=@0x0) at Server.cpp:136
    #16 0x0807a85b in CUCardI::shutdown (this=0x8111038, c=@0x0) at Server.cpp:136
    ---Type <return> to continue, or q <return> to quit---q
    Quit
    (gdb) frame 11
    #11 0x080cfa2e in Clogger::add (this=0x80e8780, facility=0, severity=9,
    message=@0x42ba2590) at ostream:199
    199 return this->operator<<(static_cast<long>(__n));
    (gdb) print severity
    $1 = 9
    (gdb) frame 12
    #12 0x0807a829 in CUCardI::shutdown (this=0x8111038, c=@0x0) at stl_alloc.h:652
    652 allocator() throw() {}
    (gdb) print c
    $3 = (const Ice::Current &) @0x0: Cannot access memory at address 0x0
    (gdb)
  • mes
    mes California
    Don,

    Looking at the code you showed in your first message:
    dthompson wrote:
    shutdown routine in server:
    void
    CUCardI::shutdown(const Ice::Current & c) {
    DataLog.add(SYS,SHUT,"Server Shutdown");
    DataLog.close();
    shutdown(c);
    }
    It appears you are calling shutdown recursively, which would explain the very large stack trace.

    - Mark
  • done!

    Thanks!
    Sometimes it's hard to see the stupid mistakes...somehow the first of the line got cut.

    Don

    CUCardI::shutdown(const Ice::Current & c) {
    DataLog.add(SYS,SHUT,"Server Shutdown");
    DataLog.close();
    std::cout << "CARD Server Shutting down..." << std::endl;
    c.adapter->getCommunicator()->shutdown();
    }