0

当我使用 ACE_5.7.1 时,我的 linux(ubuntu 12.04) 进程崩溃。我的代码:

  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);

堆栈信息:

 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 ?? ()

谁知道为什么这些代码会导致异常。非常感谢。

4

1 回答 1

0

您正在将自动对象传递给connect,我怀疑这是导致问题的原因。尝试动态分配传递给的对象,或者使它们成为在您调用的函数终止connect后仍然存在的对象的属性。connect与连接器对象相同。

于 2013-10-17T14:18:27.350 回答