作者 主題: boost socket close 造成的 Segmentation fault.  (閱讀 7322 次)

0 會員 與 1 訪客 正在閱讀本文。

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
XD ......  一定要這麼難搞...

[root@FIEND wge_server]# gdb sbin/wge core.5472

GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/cpp/wge_server/sbin/wge...done.
[New Thread 5474]
[New Thread 5475]
[New Thread 5472]
[New Thread 5473]
Missing separate debuginfo for /usr/local/wge/server/boost/lib/libboost_system.so.1.50.0
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/c3/337ba893c244011a9007b761af66b82fb5af7a
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libPhpFpm.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/7b/cb561cb29f74b1fd8f6121b1ef8b24babe5890
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libWgeBase64.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/1b/1cd9c7370849727662953e57da8d4e5c0e7c78
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libWgeJsoncpp.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/b8/1f4d99f40ef14d4dbb56900669dad627d4f09d
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libZlib.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/6f/50ef6e38d3cb1e25ba8b37d6bce700e6ee6d0f
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libWgeOpenssl.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/a1/6668595410ed1f78e46ce2b00168c58107f102
Missing separate debuginfo for /usr/local/wge/server/poco/lib/libPocoFoundation.so.12
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/9b/d1532f5e378a14a2cd3d2ba460fd79ebae579b
Missing separate debuginfo for
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/74/22987f6cfa699f465b0327139aac3fdac4a838
Reading symbols from /usr/local/wge/server/boost/lib/libboost_system.so.1.50.0...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/boost/lib/libboost_system.so.1.50.0
Reading symbols from /usr/local/wge/server/wge/lib/libPhpFpm.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libPhpFpm.so
Reading symbols from /usr/local/wge/server/wge/lib/libWgeBase64.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libWgeBase64.so
Reading symbols from /usr/local/wge/server/wge/lib/libWgeJsoncpp.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libWgeJsoncpp.so
Reading symbols from /usr/local/wge/server/wge/lib/libZlib.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libZlib.so
Reading symbols from /usr/local/wge/server/wge/lib/libWgeOpenssl.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libWgeOpenssl.so
Reading symbols from /usr/lib64/libstdc++.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libstdc++.so.6
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libgcc_s.so.1
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /usr/local/wge/server/poco/lib/libPocoFoundation.so.12...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/poco/lib/libPocoFoundation.so.12
Reading symbols from /usr/lib64/libcrypto.so.10...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libcrypto.so.10
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libz.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libz.so.1
Core was generated by `./sbin/wge'.
Program terminated with signal 11, Segmentation fault.
#0  0x000000000040f3cb in close (this=0x2abe54002e90) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:103
103             (impl.state_ & socket_ops::possible_dup) == 0);
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.3.x86_64 libgcc-4.4.6-4.el6.x86_64 libstdc++-4.4.6-4.el6.x86_64 openssl-1.0.0-25.el6_3.1.x86_64 zlib-1.2.3-27.el6.x86_64
(gdb) bt
#0  0x000000000040f3cb in close (this=0x2abe54002e90) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:103
#1  close (this=0x2abe54002e90) at /usr/local/wge/server/boost/include/boost/asio/stream_socket_service.hpp:151
#2  boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::close (this=0x2abe54002e90) at /usr/local/wge/server/boost/include/boost/asio/basic_socket.hpp:309
#3  0x00000000004147d3 in session::loginChk (this=0x2abe54002e10) at ./src/wge.cpp:444
#4  0x0000000000414f00 in session::readClientRequest (this=0x2abe54002e10) at ./src/wge.cpp:606
#5  0x0000000000409545 in call<boost::shared_ptr<session>, boost::system::error_code const, unsigned long> (owner=<value optimized out>, base=<value optimized out>)
    at /usr/local/wge/server/boost/include/boost/bind/mem_fn_template.hpp:271
#6  operator()<boost::shared_ptr<session> > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/mem_fn_template.hpp:286
#7  operator()<boost::_mfi::mf2<void, session, const boost::system::error_code&, long unsigned int>, boost::_bi::list2<const boost::system::error_code&, const long unsigned int&> > (owner=<value optimized out>,
    base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/bind.hpp:392
#8  operator()<boost::system::error_code, long unsigned int> (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/bind_template.hpp:102
#9  operator() (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/bind_handler.hpp:118
#10 asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long> > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/handler_invoke_hook.hpp:64
#11 invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/handler_invoke_helpers.hpp:39
#12 boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >::do_complete (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/reactive_socket_recv_op.hpp:110
#13 0x000000000040e8f2 in complete (owner=0x2abe54000910, base=<value optimized out>, ec=..., bytes_transferred=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/task_io_service_operation.hpp:37
#14 boost::asio::detail::epoll_reactor::descriptor_state::do_complete (owner=0x2abe54000910, base=<value optimized out>, ec=..., bytes_transferred=<value optimized out>)
    at /usr/local/wge/server/boost/include/boost/asio/detail/impl/epoll_reactor.ipp:650
#15 0x0000000000410a15 in complete (this=0x2abe54000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/task_io_service_operation.hpp:37
#16 do_run_one (this=0x2abe54000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/task_io_service.ipp:394
#17 boost::asio::detail::task_io_service::run (this=0x2abe54000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/task_io_service.ipp:146
#18 0x0000000000404c2e in run () at /usr/local/wge/server/boost/include/boost/asio/impl/io_service.ipp:59
#19 startServer () at ./src/wge.cpp:864
#20 0x0000003e978b6470 in ?? () from /usr/lib64/libstdc++.so.6
#21 0x000000342be07851 in start_thread () from /lib64/libpthread.so.0
#22 0x000000342b6e76dd in clone () from /lib64/libc.so.6
(gdb) q



TRACE 到 :

#0  0x000000000040f3cb in close (this=0x2abe54002e90) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:103

跑到 官方看 :

https://svn.boost.org/trac/boost/ticket/7275

@@"

C++11 會造成 103 行的錯誤... 沒錯我也是用 C++11 XD ...

好新的BUG 12天前~


##########

目前正在安裝 1.51 版...

看起來 1.51 修正了很多 c++11  的問題.

http://www.boost.org/users/history/version_1_51_0.html

New Libraries

    Context: Context switching library, from Oliver Kowalke.

Updated Libraries

    Algorithm:
        Fixed is_sorted_until ; now matches the c++11 standard behavior on ranges with duplicate values.
        Added range support for the rest of the search algorithms.
        unhex now uses Boost.Exception to signal bad input.
    Asio:
        Fixed an incompatibility between ip::tcp::iostream and C++11 (#7162).
        Decorated GCC attribute names with underscores to prevent interaction with user-defined macros (#6415).
        Added missing #include <cctype>, needed for some versions of MinGW.
        Changed to use gcc's atomic builtins on ARM CPUs, when available (#7140).
        Changed strand destruction to be a no-op, to allow strand objects to be destroyed after their associated io_service has been destroyed.
        Added support for some newer versions of glibc which provide the epoll_create1() function but always fail with ENOSYS (#7012).
        Changed the SSL implementation to throw an exception if SSL engine initialisation fails (#6303).
        Fixed another regression in buffered_write_stream (#6310).
        Implemented various minor performance improvements, primarily targeted at Linux x86 and x86-64 platforms.
    Config:
        Deprecated a whole bunch of macros that were c++11 specific, but not named to show that they were c++11 specific. Made new macros with better names, and paired the old macros with the new ones. Updated the documentation to list the deprecated macros.
    Chrono:
        #6918 Boost Chrono compilation failure on HP uX due to undefined pthread_getcpuclockid.
        #6241 boost::chrono compilation problems without std::wstring support.
        #6987 Documentation & C++11.
        #7041 time_point.hpp depends on Boost.System.
        #7042 Avoiding time_point and duration dependency on time.h and CLOCK_REALTIME.
        #7058 Make it work when BOOST_NO_EXCEPTIONS is defined.
        #7069 Misspellings in clock_string<thread_clock>.
        #7081 WinError.h capitalization in boost/detail/win/basic_types.hpp.
    Geometry:
        points accessed through a pointer (e.g. in a linestring) should now be specialized without the pointer. In previous versions a type my_point used like linestring<my_point*> had to be specalized like: template<> struct tag<my_point*>. Now the library itself removes the pointer before calling the traits class, so now it should be like: template<> struct tag<my_point>
        intersection was sometimes wrong for integer points, fixed
        documentation, order of parameters in simplify was wrong, fixed
        7030 spherical distance, fixed (by patch of Karsten Ahnert)
    Graph:
        Refactored support for internal and bundled properties in Boost.Graph-provided graph types, and cleaned up named parameter functionality:
            Enabled old-style (non-bundled) internal properties in compressed_sparse_row_graph.
            Bundled properties should work correctly for all graph types and adaptors.
        Bugs fixed:
            #6993: Typo Bundled Properties document
            #7002: Problem with initialization of CSR bidirectional graph
            #7023: Enclose internal type graphml_reader in anonymous namespace
            Other bugs and warnings not in Trac
    Hash:
        Support the standard smart pointers.
        hash_value now implemented using SFINAE to avoid implicit casts to built in types when calling it.
        Updated to use the new config macros.
    Lexical cast:
        Better performance, less memory usage for boost::array<character_type, N> and std::array<character_type, N> conversions.
        Fixed bug with volatile input parameter #7157.
    Math:
        Updated to use the new config macros.
    MSM:
        Support for boost::any http://www.boost.org/doc/libs/1_51_0/libs/msm/doc/HTML/ch03s03.html#any-event or kleene http://www.boost.org/doc/libs/1_51_0/libs/msm/doc/HTML/ch03s04.html#kleene-event as acceptable events
        Bugfix: compiler error with fsm internal table and none (compound) event.
        Bugfix: euml::defer_ leading to stack overflow.
    Proto:
        Proto transforms get pseudo-parameter pack expansion support for unpacking expressions. See the Release Notes for more information.
    Ratio:
        #7075 Workaround for error: the type of partial specialization template parameter constant "n1" depends on another template parameter.
    Regex:
        Updated to use the new config macros.
    Thread:
        #4258 Linking with boost thread does not work on mingw/gcc 4.5.
        #4885 Access violation in set_tss_data at process exit due to invalid assumption about TlsAlloc.
        #6931 mutex waits forwever with Intel Compiler and /debug:parallel
        #7044 boost 1.50.0 header missing.
        #7052 Thread: BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 only masks thread::operator==, thread::operator!= forward declarations, not definitions.
        #7066 An attempt to fix current_thread_tls_key static initialization order.
        #7074 Multiply defined symbol boost::allocator_arg.
        #7078 Trivial 64-bit warning fix on Windows for thread attribute stack size
        #7089 BOOST_THREAD_WAIT_BUG limits functionality without solving anything
    Unordered:
        Fix construction/destruction issue when using a C++11 compiler with a C++03 allocator (#7100).
        Remove a try..catch to support compiling without exceptions.
        Adjust SFINAE use to try to supprt g++ 3.4 (#7175).
        Updated to use the new config macros.
    Wave:
        See the Changelog for details.
    xpressive:
        Work around buggy wide ctype facet on cygwin and mingw.
        Work around absence of __isctype on some glibc implementations.
        op::as shouldn't assume string::iterator != char*.
        Fix assertion in cpp_regex_traits on libc++, thanks to John Fletcher.

Compilers Tested

Boost's primary test compilers are:

    Linux:
        GCC: 4.2.4, 4.3.4, 4.4.3, 4.5.3, 4.6.2, 4.7
        GCC, C++11 mode: 4.3.4, 4.4.3, 4.5.3, 4.6.2
        Intel: 11.1, 12.0, 12.1
        LLVM Clang 2.8
    OS X:
        GCC: 4.4
        GCC, C++11 mode: 4.4
        Intel: 11.1, 12.0
    Windows:
        GCC, mingw: 4.4.0, 4.4.7, 4.5.4, 4.6.3
        Visual C++: 8.0, 9.0, 10.0
    FreeBSD:
        GCC: 4.2.1, 32 and 64 bit

Boost's additional test compilers include:

    Linux:
        Clang: from subversion
        LLVM Clang: 3.0
        GCC: 4.2.4, 4.3.4, 4.4.4, 4.4.7, 4.5.3, 4.6.2, 4.6.3, 4.7.0, 4.7.1
        GCC, C++11 mode: 4.3.4, 4.4.4, 4.5.3, 4.6.3
        pgCC: 11.9
        Intel: 10.1, 11.1, 12.0, 12.1
        Visual Age: 10.1
    OS X:
        Clang: from subversion
        Clang, C++11 mode: from subversion
        Intel: 11.1, 12.0
        GCC: 4.4
        GCC, C++11 mode: 4.4
    Windows:
        Visual C++: 8.0, 9.0, 10.0
        GCC, mingw: 4.4.0, 4.6.3, 4.7.0
    AIX:
        IBM XL C/C++ Enterprise Edition: V12.1.0.0
    FreeBSD:
        GCC: 4.2.1, 32 and 64 bit
    Solaris:
        Sun: 5.10


« 上次編輯: 2012-09-05 21:26 由 FIEND »
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #1 於: 2012-09-05 21:20 »
0x2abe54002e90 是被我丟到 map 裡的 指標.

拿它出來用 並且 close socket 不會有問題...

但是 寫程式 跑了 幾十分後才會出現這個問題.....




你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #2 於: 2012-09-05 21:33 »
0x2abe54002e90 是被我丟到 map 裡的 指標.

拿它出來用 並且 close socket 不會有問題...

但是 寫程式 跑了 幾十分後才會出現這個問題.....

哈~把測試程式打進去~~跑了很久~都不會了~果然解決了~~

C++11 << 造成 1.50 版本不相容.

XD .....

用太新的技術也中槍~~~~@@

你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #3 於: 2012-09-05 21:40 »
0x2abe54002e90 是被我丟到 map 裡的 指標.

拿它出來用 並且 close socket 不會有問題...

但是 寫程式 跑了 幾十分後才會出現這個問題.....

哈~把測試程式打進去~~跑了很久~都不會了~果然解決了~~

C++11 << 造成 1.50 版本不相容.

XD .....

用太新的技術也中槍~~~~@@

才剛講完~~就跳了~ 不過錯誤的訊息不一樣了~而且少很多錯誤~~有進步~XD.

[root@FIEND wge_server]# gdb sbin/wge core.20276
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/cpp/wge_server/sbin/wge...(no debugging symbols found)...done.
[New Thread 20278]
[New Thread 20276]
[New Thread 20277]
[New Thread 20279]
Missing separate debuginfo for /usr/local/wge/server/boost/lib/libboost_system.so.1.51.0
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/43/e38b856af532331942a23fd0cfd05c3a7eb6b2
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libPhpFpm.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/7b/cb561cb29f74b1fd8f6121b1ef8b24babe5890
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libWgeBase64.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/1b/1cd9c7370849727662953e57da8d4e5c0e7c78
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libWgeJsoncpp.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/b8/1f4d99f40ef14d4dbb56900669dad627d4f09d
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libZlib.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/6f/50ef6e38d3cb1e25ba8b37d6bce700e6ee6d0f
Missing separate debuginfo for /usr/local/wge/server/wge/lib/libWgeOpenssl.so
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/a1/6668595410ed1f78e46ce2b00168c58107f102
Missing separate debuginfo for /usr/local/wge/server/poco/lib/libPocoFoundation.so.12
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/9b/d1532f5e378a14a2cd3d2ba460fd79ebae579b
Missing separate debuginfo for
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/74/22987f6cfa699f465b0327139aac3fdac4a838
Reading symbols from /usr/local/wge/server/boost/lib/libboost_system.so.1.51.0...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/boost/lib/libboost_system.so.1.51.0
Reading symbols from /usr/local/wge/server/wge/lib/libPhpFpm.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libPhpFpm.so
Reading symbols from /usr/local/wge/server/wge/lib/libWgeBase64.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libWgeBase64.so
Reading symbols from /usr/local/wge/server/wge/lib/libWgeJsoncpp.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libWgeJsoncpp.so
Reading symbols from /usr/local/wge/server/wge/lib/libZlib.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libZlib.so
Reading symbols from /usr/local/wge/server/wge/lib/libWgeOpenssl.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/wge/lib/libWgeOpenssl.so
Reading symbols from /usr/lib64/libstdc++.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libstdc++.so.6
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libgcc_s.so.1
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /usr/local/wge/server/poco/lib/libPocoFoundation.so.12...(no debugging symbols found)...done.
Loaded symbols for /usr/local/wge/server/poco/lib/libPocoFoundation.so.12
Reading symbols from /usr/lib64/libcrypto.so.10...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libcrypto.so.10
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libz.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libz.so.1
Core was generated by `./sbin/wge'.
Program terminated with signal 11, Segmentation fault.
#0  0x000000000040d19b in boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::close() ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.3.x86_64 libgcc-4.4.6-4.el6.x86_64 libstdc++-4.4.6-4.el6.x86_64 openssl-1.0.0-25.el6_3.1.x86_64 zlib-1.2.3-27.el6.x86_64
(gdb) bt
#0  0x000000000040d19b in boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::close() ()
#1  0x00000000004148f3 in session::loginChk() ()
#2  0x0000000000415020 in session::readClientRequest() ()
#3  0x0000000000409455 in boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long)
    ()
#4  0x000000000040b752 in boost::asio::detail::epoll_reactor::descriptor_state::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) ()
#5  0x000000000040e885 in boost::asio::detail::task_io_service::run(boost::system::error_code&) ()
#6  0x000000000040484e in startServer() ()
#7  0x0000003e978b6470 in ?? () from /usr/lib64/libstdc++.so.6
#8  0x000000342be07851 in start_thread () from /lib64/libpthread.so.0
#9  0x000000342b6e76dd in clone () from /lib64/libc.so.6
(gdb) q


XD!!!!!

休息一下~~@@ 想想別的解法~XD.

« 上次編輯: 2012-09-05 21:57 由 FIEND »
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #4 於: 2012-09-05 21:48 »
@@"

全部重新編譯後....

並且重新載入 ldconfig .

又完全不會了~~給它壓測一晚看看吧~XD....

是怎樣~
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #5 於: 2012-09-05 21:56 »
XD 一定要休息了....

有可能是我自己在異步IO下長指標造成的錯亂.

晚一點利用 BOOST 內建的智慧型指標 shared_ptr 再來玩一次看看.

« 上次編輯: 2012-09-05 21:57 由 FIEND »
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #6 於: 2012-09-06 11:39 »
XD 一定要休息了....

有可能是我自己在異步IO下長指標造成的錯亂.

晚一點利用 BOOST 內建的智慧型指標 shared_ptr 再來玩一次看看.

使用 智慧型指標也一樣 ....

重新 TRACE  :

Program terminated with signal 11, Segmentation fault.
#0  0x000000000040d19b in close (this=0x2ab8fc002e10) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:103
103             (impl.state_ & socket_ops::possible_dup) == 0);
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.3.x86_64 libgcc-4.4.6-4.el6.x86_64 libstdc++-4.4.6-4.el6.x86_64 openssl-1.0.0-25.el6_3.1.x86_64 zlib-1.2.3-27.el6.x86_64
(gdb) bt
#0  0x000000000040d19b in close (this=0x2ab8fc002e10) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:103
#1  close (this=0x2ab8fc002e10) at /usr/local/wge/server/boost/include/boost/asio/stream_socket_service.hpp:151
#2  boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::close (this=0x2ab8fc002e10) at /usr/local/wge/server/boost/include/boost/asio/basic_socket.hpp:309
#3  0x00000000004148f3 in session::loginChk (this=0x2ab8fc006650) at ./src/wge.cpp:446
#4  0x0000000000415020 in session::readClientRequest (this=0x2ab8fc006650) at ./src/wge.cpp:608
#5  0x0000000000409455 in call<boost::shared_ptr<session>, boost::system::error_code const, unsigned long> (owner=<value optimized out>, base=<value optimized out>)
    at /usr/local/wge/server/boost/include/boost/bind/mem_fn_template.hpp:271
#6  operator()<boost::shared_ptr<session> > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/mem_fn_template.hpp:286
#7  operator()<boost::_mfi::mf2<void, session, const boost::system::error_code&, long unsigned int>, boost::_bi::list2<const boost::system::error_code&, const long unsigned int&> > (owner=<value optimized out>,
    base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/bind.hpp:392
#8  operator()<boost::system::error_code, long unsigned int> (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/bind_template.hpp:102
#9  operator() (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/bind_handler.hpp:118
#10 asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long> > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/handler_invoke_hook.hpp:64
#11 invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/handler_invoke_helpers.hpp:39
#12 boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >::do_complete (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/reactive_socket_recv_op.hpp:110
#13 0x000000000040b752 in complete (owner=0x2ab8fc000910, base=<value optimized out>, ec=..., bytes_transferred=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/task_io_service_operation.hpp:37
#14 boost::asio::detail::epoll_reactor::descriptor_state::do_complete (owner=0x2ab8fc000910, base=<value optimized out>, ec=..., bytes_transferred=<value optimized out>)
    at /usr/local/wge/server/boost/include/boost/asio/detail/impl/epoll_reactor.ipp:650
#15 0x000000000040e885 in complete (this=0x2ab8fc000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/task_io_service_operation.hpp:37
#16 do_run_one (this=0x2ab8fc000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/task_io_service.ipp:419
#17 boost::asio::detail::task_io_service::run (this=0x2ab8fc000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/task_io_service.ipp:160
#18 0x000000000040484e in run () at /usr/local/wge/server/boost/include/boost/asio/impl/io_service.ipp:59
#19 startServer () at ./src/wge.cpp:873
#20 0x0000003e978b6470 in ?? () from /usr/lib64/libstdc++.so.6
#21 0x000000342be07851 in start_thread () from /lib64/libpthread.so.0
#22 0x000000342b6e76dd in clone () from /lib64/libc.so.6
(gdb) up
#1  close (this=0x2ab8fc002e10) at /usr/local/wge/server/boost/include/boost/asio/stream_socket_service.hpp:151
151         return service_impl_.close(impl, ec);
(gdb)
#2  boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::close (this=0x2ab8fc002e10) at /usr/local/wge/server/boost/include/boost/asio/basic_socket.hpp:309
309         this->get_service().close(this->get_implementation(), ec);
(gdb)
#3  0x00000000004148f3 in session::loginChk (this=0x2ab8fc006650) at ./src/wge.cpp:446
446                                                     userPtr->getUsock(uid)->close();
(gdb)
#4  0x0000000000415020 in session::readClientRequest (this=0x2ab8fc006650) at ./src/wge.cpp:608
608                                             loginChk();
(gdb)
#5  0x0000000000409455 in call<boost::shared_ptr<session>, boost::system::error_code const, unsigned long> (owner=<value optimized out>, base=<value optimized out>)
    at /usr/local/wge/server/boost/include/boost/bind/mem_fn_template.hpp:271
271             BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2);
(gdb)
#6  operator()<boost::shared_ptr<session> > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/mem_fn_template.hpp:286
286             BOOST_MEM_FN_RETURN call(u, p, a1, a2);
(gdb)
#7  operator()<boost::_mfi::mf2<void, session, const boost::system::error_code&, long unsigned int>, boost::_bi::list2<const boost::system::error_code&, const long unsigned int&> > (owner=<value optimized out>,
    base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/bind.hpp:392
392             unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
(gdb)
#8  operator()<boost::system::error_code, long unsigned int> (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/bind/bind_template.hpp:102
102             BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
(gdb)
#9  operator() (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/bind_handler.hpp:118
118         handler_(static_cast<const Arg1&>(arg1_),
(gdb)
#10 asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long> > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/handler_invoke_hook.hpp:64
64        function();
(gdb)
#11 invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > > (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/handler_invoke_helpers.hpp:39
39        asio_handler_invoke(function, boost::addressof(context));
(gdb)
#12 boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::_bi::bind_t<void, boost::_mfi::mf2<void, session, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<session> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >::do_complete (owner=<value optimized out>, base=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/reactive_socket_recv_op.hpp:110
110           boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
(gdb)
#13 0x000000000040b752 in complete (owner=0x2ab8fc000910, base=<value optimized out>, ec=..., bytes_transferred=<value optimized out>) at /usr/local/wge/server/boost/include/boost/asio/detail/task_io_service_operation.hpp:37
37          func_(&owner, this, ec, bytes_transferred);
(gdb)
#14 boost::asio::detail::epoll_reactor::descriptor_state::do_complete (owner=0x2ab8fc000910, base=<value optimized out>, ec=..., bytes_transferred=<value optimized out>)
    at /usr/local/wge/server/boost/include/boost/asio/detail/impl/epoll_reactor.ipp:650
650           op->complete(*owner, ec, 0);
(gdb)
#15 0x000000000040e885 in complete (this=0x2ab8fc000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/task_io_service_operation.hpp:37
37          func_(&owner, this, ec, bytes_transferred);
(gdb)
#16 do_run_one (this=0x2ab8fc000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/task_io_service.ipp:419
419             o->complete(*this, ec, task_result);
(gdb)
#17 boost::asio::detail::task_io_service::run (this=0x2ab8fc000910, ec=...) at /usr/local/wge/server/boost/include/boost/asio/detail/impl/task_io_service.ipp:160
160       for (; do_run_one(lock, this_thread, ec); lock.lock())
(gdb)
#18 0x000000000040484e in run () at /usr/local/wge/server/boost/include/boost/asio/impl/io_service.ipp:59
59        std::size_t s = impl_.run(ec);
(gdb)
#19 startServer () at ./src/wge.cpp:873
873                     io_service.run();
(gdb)
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #7 於: 2012-09-06 13:40 »
#1  close (this=0x2ab8fc002e10) at /usr/local/wge/server/boost/include/boost/asio/stream_socket_service.hpp:151
151         return service_impl_.close(impl, ec);
(gdb)
#2  boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::close (this=0x2ab8fc002e10) at /usr/local/wge/server/boost/include/boost/asio/basic_socket.hpp:309
309         this->get_service().close(this->get_implementation(), ec);


解決了...

我是硬解的 目前還不知道為什麼指標丟到 close  內 .

impl 為什麼會 Segmentation fault.

於是我 把 指標 socket 的狀態一個個倒出來看.


        std::map<int,tcp::socket*> usock;
        std::map<int,tcp::socket*>::iterator usockit;
        std::pair<map<int,tcp::socket*>::iterator,bool> socketRet ;
        tcp::socket* psocket ;

        boost::system::error_code ec;
        boost::asio::ip::tcp::socket::keep_alive option;

        psocket = getUsock(uid) ;
        psocket->get_option(option, ec)  ;   <<< 這裡每次在還沒有出現 Segmentation fault. 時會倒出 0
                                                                         但是一但出錯就會倒出 9 , 88
                                                                         於是我把 倒出來是 9 , 88 以外的動作停下來 讓 0 的動作發生.
                                                                         有空再查 system:9 , system:88 是什麼意思.



這個問題有可能是重覆 FREE 記憶體造成的.

等我找到 system:9 代表什麼意思就有解答了.
« 上次編輯: 2012-09-06 13:58 由 FIEND »
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #8 於: 2012-09-06 14:14 »
搞定 ................




        bool addUsock(int uid,tcp::socket* psocket){
                socketRet = usock.insert(pair<int,tcp::socket*>(uid,psocket)); ;
                if(socketRet.second == false){
                        return false ;
                }
                return true ;
        }


        tcp::socket* getUsock(int uid){

                if(usock.count(uid) > 0 ){
                        psocket = usock.find(uid)->second;
                }
                return psocket ;
        }

        void usockClose(int uid){
                psocket = NULL ;
                if(uid > 0 ){
                        psocket = getUsock(uid) ;
                        if(DEBUG_MODE == 1){
                                std::cout << "psock          : " << psocket << std::endl ;
                                std::cout << "psock stat     : " << psocket->is_open() << std::endl ;
                                std::cout << "option         : " << psocket->get_option(option, ec) << std::endl ;
                                std::cout << "error code     : " << ec.value() << std::endl ;
                        }
                        if(psocket != NULL){
                                psocket->get_option(option, ec) ;
                                if(ec.value() == 0 ){
                                        //psocket->shutdown(boost::asio::ip::tcp::socket::shutdown_both,ec);
                                        psocket->close(ec);
                                }
                        }
                }
        }



        std::map<int,tcp::socket*> usock;
        std::map<int,tcp::socket*>::iterator usockit;
        std::pair<map<int,tcp::socket*>::iterator,bool> socketRet ;
        tcp::socket* psocket ;
        boost::system::error_code ec;
        boost::asio::ip::tcp::socket::keep_alive option;
 
« 上次編輯: 2012-09-06 15:18 由 FIEND »
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: boost socket close 造成的 Segmentation fault.
« 回覆 #9 於: 2012-09-06 15:19 »
玩了好久~~~還沒死~~

現在正用 SERVER DOS~CLIENT 端 :

這次真的搞定了~嘿嘿..



DOS 攻擊~伺服端  :

弄好久了~~還沒死~~......

« 上次編輯: 2012-09-06 15:36 由 FIEND »
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......