0

My linux(ubuntu 12.04) process crash when I use ACE_5.7.1. My code:

  ACE_INET_Addr remote_addr(server_addr.c_str());
    ACE_SOCK_Stream stream;
    ACE_SOCK_Connector connector;
    ACE_Time_Value to(1, 0), to2(2,0);
    ret = connector.connect(stream, remote_addr, &to);

Stack info:

 Program terminated with signal 6, Aborted
    #0  0x00002b47daf8d425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  0x00002b47daf8d425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    #1  0x00002b47daf90b8b in __GI_abort () at abort.c:91
    #2  0x00002b47dafcb39e in __libc_message (do_abort=2, fmt=0x2b47db0d2e3f "*** %s ***: %s terminated\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:201
    #3  0x00002b47db061817 in __GI___fortify_fail (msg=0x2b47db0d2dd6 "buffer overflow detected") at fortify_fail.c:32
    #4  0x00002b47db060710 in __GI___chk_fail () at chk_fail.c:29
    #5  0x00002b47db0617ce in __fdelt_chk (d=<optimized out>) at fdelt_chk.c:26
    #6  0x00002b47d9ee9c3b in is_set (handle=1537, this=0x2b48883e9d90) at /home/cfcheng/MSP4.0/source/source/engine/ivs/../../share/ACE-5.7.1/ace/Handle_Set.inl:84
    #7  set_bit (handle=1537, this=0x2b48883e9d90) at /home/cfcheng/MSP4.0/source/source/engine/ivs/../../share/ACE-5.7.1/ace/Handle_Set.inl:103
    #8  ACE::handle_timed_complete (h=1537, timeout=0x2b48883ea110, is_tli=0) at ACE.cpp:2547
    #9  0x00002b47d9f4e5c7 in ACE_SOCK_Connector::complete (this=<optimized out>, new_stream=..., remote_sap=0x0, tv=<optimized out>) at SOCK_Connector.cpp:262
    #10 0x00002b47d9f4e737 in ACE_SOCK_Connector::shared_connect_finish (this=0x2b48883ea17f, new_stream=..., timeout=0x2b48883ea110, result=-1) at SOCK_Connector.cpp:155
    #11 0x000000000044f4a9 in res_update_work::send_notify(std::string const&, std::string const&) ()
    #12 0x000000000044fe7e in res_update_work::batch_send(std::string const&, ACE_Time_Value const&, bool) ()
    #13 0x00000000004506c5 in res_update_work::update_all_res() ()
    #14 0x0000000000450ada in res_update_work::svc() ()
    #15 0x00002b47d9f56427 in ACE_Task_Base::svc_run (args=0x3e5a490) at Task.cpp:275
    #16 0x00002b47d9f578c4 in ACE_Thread_Adapter::invoke (this=0x3e5ae90) at Thread_Adapter.cpp:98
    #17 0x00002b47dad41e9a in start_thread (arg=0x2b4888401700) at pthread_create.c:308
    #18 0x00002b47db04accd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
    #19 0x0000000000000000 in ?? ()

Who know why these code cause exception. Thanks very much.

1 Answers1

0

You are passing automatic objects to connect , I suspect this is causing the problem. Try to allocate the objects passed to connect dynamically, or make them attributes of an object which is still alive after the function where you call connect terminates. The same with the connector object.

piokuc
  • 25,594
  • 11
  • 72
  • 102