• ACE crashes when unit tests exit

    From Mikael Springer@21:1/5 to All on Fri Nov 25 00:04:58 2016
    ACE VERSION:

    5.4


    HOST MACHINE and OPERATING SYSTEM:

    Linux, openSUSE Leap 42.2 64b


    COMPILER NAME AND VERSION (AND PATCHLEVEL):

    Gcc 3.3.4 32b (compiling 32b on 64b machine)


    THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
    specific file, simply state which one]:

    #include "ace/config-linux.h"


    THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
    use a link to a platform-specific file, simply state which one
    (unless this isn't used in this case, e.g., with Microsoft Visual
    C++)]:

    CXX = /usr/local/cppenv/CppEnv/linux/gcc/3.3.6/bin/g++
    CC = /usr/local/cppenv/CppEnv/linux/gcc/3.3.6/bin/gcc
    CFLAGS=-m32
    CXXFLAGS=-m32
    LDFLAGS=-m32 -L/usr/local/cppenv/CppEnv/linux/gcc/3.3.6/lib
    include /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/include/makeinclude/platform_linux.GNU


    AREA/CLASS/EXAMPLE AFFECTED:

    Our unit test suite of software using ACE.


    DOES THE PROBLEM AFFECT:
    EXECUTION?

    Our unit test suite crashes on exit every time.


    SYNOPSIS:

    Our unit test suite compiles and runs fine, all tests pass but when the unit test application exits it crashes every time producing a core. The problem seems to be in the reactor destructor.

    We do ACE::init() and ACE::fini() in the unit test suite main function. The unit tests do not use any mocks so event handlers and timers are registered in the reactor but the reactor event loop is never activated (since it is an unit test suite). The
    tested code base is very large so it is nearly impossible to know exactly when and where handlers are registered in the reactor.


    DESCRIPTION:

    (gdb) run
    Starting program: /home/micke/devel/projects/LCC/utest
    Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-2.22-3.7.x86_64
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1". ...ACE_INET_Addr::ACE_INET_Addr: : Success
    ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .........ACE_INET_Addr::ACE_INET_Addr: : Success
    .....

    OK (26)

    Program received signal SIGSEGV, Segmentation fault.
    0x00000000 in ?? ()
    Missing separate debuginfos, use: zypper install libaio1-32bit-debuginfo-0.3.109-20.2.x86_64 libgcc_s1-32bit-debuginfo-5.3.1+r233831-7.1.x86_64
    (gdb) bt
    #0 0x00000000 in ?? ()
    #1 0xf5597e20 in ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Recursive_Thread_Mutex>::cancel_type (this=0x87d8448,
    event_handler=0x87c7418, dont_call=0, requires_reference_counting=@0x0: <error reading variable>)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Timer_Queue_T.cpp:448
    #2 0xf5597e7f in ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Recursive_Thread_Mutex>::deletion (this=0x87d8448,
    timer_queue=..., event_handler=0x87c7418) at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Timer_Queue_T.cpp:473
    #3 0xf559699d in ACE_Timer_Heap_T<ACE_Event_Handler*, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Recursive_Thread_Mutex>, ACE_Recursive_Thread_Mutex>::~ACE_Timer_Heap_T (this=0x87d8368, __in_chrg=<optimized out>)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Timer_Queue_T.i:216
    #4 0xf5590403 in ACE_Select_Reactor_T<ACE_Select_Reactor_Token_T<ACE_Token> >::close (this=<optimized out>,
    this=<optimized out>, l=..., this=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Select_Reactor_T.cpp:644
    #5 0xf558fcf0 in ACE_Select_Reactor_T<ACE_Select_Reactor_Token_T<ACE_Token> >::~ACE_Select_Reactor_T (this=0x87d7dc0,
    __in_chrg=<optimized out>) at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Select_Reactor_T.cpp:669
    #6 0xf55a4ddd in ACE_TP_Reactor::~ACE_TP_Reactor (this=0x87d7dc0, __in_chrg=<optimized out>) at TP_Reactor.cpp:308
    #7 0xf55a026b in ACE_Reactor::~ACE_Reactor (this=0x87d7db0, __in_chrg=<optimized out>)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Reactor.i:9
    #8 0xf7be0ee0 in TAO_Default_Resource_Factory::reclaim_reactor (this=0x879c66c <std::string::_S_empty_rep_storage+12>,
    reactor=0x0) at default_resource.cpp:774
    #9 0xf7c62a69 in TAO_Leader_Follower::~TAO_Leader_Follower (this=0x87d7d20, __in_chrg=<optimized out>)
    at Leader_Follower.cpp:30
    #10 0xf7ca0ffa in TAO_Thread_Lane_Resources::finalize (this=<optimized out>, this=<optimized out>, handlers=...,
    this=<optimized out>, l=..., this=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>,
    this=<optimized out>) at Thread_Lane_Resources.cpp:392
    #11 0xf7ca1f32 in TAO_Default_Thread_Lane_Resources_Manager::finalize (this=0x879c66c <std::string::_S_empty_rep_storage+12>)
    at Default_Thread_Lane_Resources_Manager.cpp:48
    #12 0xf7c595c8 in TAO_ORB_Core::fini (this=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>,
    obj=<optimized out>, obj=<optimized out>, obj=<optimized out>, obj=<optimized out>, obj=<optimized out>)
    at ORB_Core.cpp:1168
    #13 0xf7c601f8 in TAO_ORB_Core::_decr_refcnt (this=<optimized out>, this=<optimized out>, l=..., this=<optimized out>,
    this=<optimized out>, m=<optimized out>, m=<optimized out>, this=<optimized out>, this=<optimized out>,
    this=<optimized out>, this=<optimized out>, m=<optimized out>, m=<optimized out>) at ORB_Core.i:22
    #14 0xf7c60da4 in TAO_ORB_Table::~TAO_ORB_Table (this=0x87c76cc, __in_chrg=<optimized out>) at ORB_Table.cpp:33
    #15 0xf7c61b33 in TAO_Singleton<TAO_ORB_Table, ACE_Thread_Mutex>::~TAO_Singleton (this=0x87c76c8, __in_chrg=<optimized out>)
    at ORB_Table.cpp:201
    #16 0xf7c61ba3 in TAO_Singleton<TAO_ORB_Table, ACE_Thread_Mutex>::cleanup (this=0x0)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/TAO/tao/TAO_Singleton.cpp:108
    #17 0xf5545958 in ace_cleanup_destroyer (object=0x879c66c <std::string::_S_empty_rep_storage+12>, param=0x0) at Cleanup.cpp:30
    #18 0xf5545ef1 in ACE_OS_Exit_Info::call_hooks (this=0x879c66c <std::string::_S_empty_rep_storage+12>) at Cleanup.cpp:178
    #19 0xf7c88acd in TAO_Singleton_Manager::fini (this=0x87af0d0) at TAO_Singleton_Manager.cpp:231
    #20 0xf7c883c2 in TAO_Singleton_Manager_cleanup_destroyer () at TAO_Singleton_Manager.cpp:37
    #21 0xf5545ec7 in ACE_OS_Exit_Info::call_hooks (this=0x879c66c <std::string::_S_empty_rep_storage+12>) at Cleanup.cpp:185
    #22 0xf55684a3 in ACE_Object_Manager::fini (this=0x87a1160) at Object_Manager.cpp:612
    #23 0xf55638b5 in ACE_Init_ACE::fini () at Init_ACE.cpp:36
    #24 0x0853ec97 in main (argc=1, argv=0xffffca54) at unittest.cpp:37
    (gdb)

    REPEAT BY:
    Running the unit test suite.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ajay@21:1/5 to Mikael Springer on Sun Nov 27 18:44:50 2016
    On Friday, November 25, 2016 at 1:35:00 PM UTC+5:30, Mikael Springer wrote:
    ACE VERSION:

    5.4


    HOST MACHINE and OPERATING SYSTEM:

    Linux, openSUSE Leap 42.2 64b


    COMPILER NAME AND VERSION (AND PATCHLEVEL):

    Gcc 3.3.4 32b (compiling 32b on 64b machine)


    THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
    specific file, simply state which one]:

    #include "ace/config-linux.h"


    THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
    use a link to a platform-specific file, simply state which one
    (unless this isn't used in this case, e.g., with Microsoft Visual
    C++)]:

    CXX = /usr/local/cppenv/CppEnv/linux/gcc/3.3.6/bin/g++
    CC = /usr/local/cppenv/CppEnv/linux/gcc/3.3.6/bin/gcc
    CFLAGS=-m32
    CXXFLAGS=-m32
    LDFLAGS=-m32 -L/usr/local/cppenv/CppEnv/linux/gcc/3.3.6/lib
    include /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/include/makeinclude/platform_linux.GNU


    AREA/CLASS/EXAMPLE AFFECTED:

    Our unit test suite of software using ACE.


    DOES THE PROBLEM AFFECT:
    EXECUTION?

    Our unit test suite crashes on exit every time.


    SYNOPSIS:

    Our unit test suite compiles and runs fine, all tests pass but when the unit test application exits it crashes every time producing a core. The problem seems to be in the reactor destructor.

    We do ACE::init() and ACE::fini() in the unit test suite main function. The unit tests do not use any mocks so event handlers and timers are registered in the reactor but the reactor event loop is never activated (since it is an unit test suite). The
    tested code base is very large so it is nearly impossible to know exactly when and where handlers are registered in the reactor.


    DESCRIPTION:

    (gdb) run
    Starting program: /home/micke/devel/projects/LCC/utest
    Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-2.22-3.7.x86_64
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1". ...ACE_INET_Addr::ACE_INET_Addr: : Success
    ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success
    .ACE_INET_Addr::ACE_INET_Addr: : Success .........ACE_INET_Addr::ACE_INET_Addr: : Success
    .....

    OK (26)

    Program received signal SIGSEGV, Segmentation fault.
    0x00000000 in ?? ()
    Missing separate debuginfos, use: zypper install libaio1-32bit-debuginfo-0.3.109-20.2.x86_64 libgcc_s1-32bit-debuginfo-5.3.1+r233831-7.1.x86_64
    (gdb) bt
    #0 0x00000000 in ?? ()
    #1 0xf5597e20 in ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Recursive_Thread_Mutex>::cancel_type (this=0x87d8448,
    event_handler=0x87c7418, dont_call=0, requires_reference_counting=@0x0: <error reading variable>)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Timer_Queue_T.cpp:448
    #2 0xf5597e7f in ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Recursive_Thread_Mutex>::deletion (this=0x87d8448,
    timer_queue=..., event_handler=0x87c7418) at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Timer_Queue_T.cpp:473
    #3 0xf559699d in ACE_Timer_Heap_T<ACE_Event_Handler*, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Recursive_Thread_Mutex>, ACE_Recursive_Thread_Mutex>::~ACE_Timer_Heap_T (this=0x87d8368, __in_chrg=<optimized out>)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Timer_Queue_T.i:216
    #4 0xf5590403 in ACE_Select_Reactor_T<ACE_Select_Reactor_Token_T<ACE_Token> >::close (this=<optimized out>,
    this=<optimized out>, l=..., this=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Select_Reactor_T.cpp:644
    #5 0xf558fcf0 in ACE_Select_Reactor_T<ACE_Select_Reactor_Token_T<ACE_Token> >::~ACE_Select_Reactor_T (this=0x87d7dc0,
    __in_chrg=<optimized out>) at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Select_Reactor_T.cpp:669
    #6 0xf55a4ddd in ACE_TP_Reactor::~ACE_TP_Reactor (this=0x87d7dc0, __in_chrg=<optimized out>) at TP_Reactor.cpp:308
    #7 0xf55a026b in ACE_Reactor::~ACE_Reactor (this=0x87d7db0, __in_chrg=<optimized out>)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/ace/Reactor.i:9
    #8 0xf7be0ee0 in TAO_Default_Resource_Factory::reclaim_reactor (this=0x879c66c <std::string::_S_empty_rep_storage+12>,
    reactor=0x0) at default_resource.cpp:774
    #9 0xf7c62a69 in TAO_Leader_Follower::~TAO_Leader_Follower (this=0x87d7d20, __in_chrg=<optimized out>)
    at Leader_Follower.cpp:30
    #10 0xf7ca0ffa in TAO_Thread_Lane_Resources::finalize (this=<optimized out>, this=<optimized out>, handlers=...,
    this=<optimized out>, l=..., this=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>,
    this=<optimized out>) at Thread_Lane_Resources.cpp:392
    #11 0xf7ca1f32 in TAO_Default_Thread_Lane_Resources_Manager::finalize (this=0x879c66c <std::string::_S_empty_rep_storage+12>)
    at Default_Thread_Lane_Resources_Manager.cpp:48
    #12 0xf7c595c8 in TAO_ORB_Core::fini (this=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>,
    obj=<optimized out>, obj=<optimized out>, obj=<optimized out>, obj=<optimized out>, obj=<optimized out>)
    at ORB_Core.cpp:1168
    #13 0xf7c601f8 in TAO_ORB_Core::_decr_refcnt (this=<optimized out>, this=<optimized out>, l=..., this=<optimized out>,
    this=<optimized out>, m=<optimized out>, m=<optimized out>, this=<optimized out>, this=<optimized out>,
    this=<optimized out>, this=<optimized out>, m=<optimized out>, m=<optimized out>) at ORB_Core.i:22
    #14 0xf7c60da4 in TAO_ORB_Table::~TAO_ORB_Table (this=0x87c76cc, __in_chrg=<optimized out>) at ORB_Table.cpp:33
    #15 0xf7c61b33 in TAO_Singleton<TAO_ORB_Table, ACE_Thread_Mutex>::~TAO_Singleton (this=0x87c76c8, __in_chrg=<optimized out>)
    at ORB_Table.cpp:201
    #16 0xf7c61ba3 in TAO_Singleton<TAO_ORB_Table, ACE_Thread_Mutex>::cleanup (this=0x0)
    at /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/TAO/tao/TAO_Singleton.cpp:108
    #17 0xf5545958 in ace_cleanup_destroyer (object=0x879c66c <std::string::_S_empty_rep_storage+12>, param=0x0) at Cleanup.cpp:30
    #18 0xf5545ef1 in ACE_OS_Exit_Info::call_hooks (this=0x879c66c <std::string::_S_empty_rep_storage+12>) at Cleanup.cpp:178
    #19 0xf7c88acd in TAO_Singleton_Manager::fini (this=0x87af0d0) at TAO_Singleton_Manager.cpp:231
    #20 0xf7c883c2 in TAO_Singleton_Manager_cleanup_destroyer () at TAO_Singleton_Manager.cpp:37
    #21 0xf5545ec7 in ACE_OS_Exit_Info::call_hooks (this=0x879c66c <std::string::_S_empty_rep_storage+12>) at Cleanup.cpp:185
    #22 0xf55684a3 in ACE_Object_Manager::fini (this=0x87a1160) at Object_Manager.cpp:612
    #23 0xf55638b5 in ACE_Init_ACE::fini () at Init_ACE.cpp:36
    #24 0x0853ec97 in main (argc=1, argv=0xffffca54) at unittest.cpp:37
    (gdb)

    REPEAT BY:
    Running the unit test suite.



    Please check your application code . This is the same case which occur at my application few months old . There is a scenario of not proper handling of cancel_timer in your application.

    i have fixed it using below code in my application

    if (this->reactor())
    this->reactor()->cancel_timer(this);

    Hopefully it's useful for you.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)