Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash while endpoint destruction #103

Closed
maxim-ky opened this issue Apr 11, 2012 · 2 comments
Closed

Crash while endpoint destruction #103

maxim-ky opened this issue Apr 11, 2012 · 2 comments

Comments

@maxim-ky
Copy link

I have strange crash after pulling last version (all commits after "fix 78 issue"). Application crashes in websocketpp::server destructor.
It's a backtrace for this crash:

0  0xb7861424 in __kernel_vsyscall ()
1  0xb72f6911 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
2  0xb72f9d42 in *__GI_abort () at abort.c:92
3  0xb72efb28 in *__GI___assert_fail (assertion=0x85e9f28 "!pthread_mutex_destroy(&m)", 
    file=0x85e9efc "/usr/include/boost/thread/pthread/mutex.hpp", line=47, function=0x85eb7b1 "boost::mutex::~mutex()") at assert.c:81
4  0x083e8ca5 in boost::mutex::~mutex (this=0x968c118, __in_chrg=<optimized out>) at /usr/include/boost/thread/pthread/mutex.hpp:47
5  0x083ec525 in websocketpp::message::data::~data (this=0x968c0e0, __in_chrg=<optimized out>)
    at /usr/local/include/websocketpp/roles/../processors/../messages/data.hpp:158
6  0x083ec597 in boost::checked_delete<websocketpp::message::data const> (x=0x968c0e0) at /usr/include/boost/checked_delete.hpp:34
7  0x083e8e48 in websocketpp::message::intrusive_ptr_release (s=0x968c0e0)
    at /usr/local/include/websocketpp/roles/../processors/../messages/data.hpp:232
8  0x083ec36a in boost::intrusive_ptr<websocketpp::message::data>::~intrusive_ptr (this=0x966d2f0, __in_chrg=<optimized out>)
    at /usr/include/boost/smart_ptr/intrusive_ptr.hpp:96
9  0x083fe67d in std::_Destroy<boost::intrusive_ptr<websocketpp::message::data> > (__pointer=0x966d2f0)
    at /usr/include/c++/4.6/bits/stl_construct.h:94
10 0x083fc7b2 in std::_Destroy_aux<false>::__destroy<boost::intrusive_ptr<websocketpp::message::data>*> (__first=0x966d2f0, __last=0x966d2f8)
    at /usr/include/c++/4.6/bits/stl_construct.h:104
11 0x083f9465 in std::_Destroy<boost::intrusive_ptr<websocketpp::message::data>*> (__first=0x966d2f0, __last=0x966d2f8)
    at /usr/include/c++/4.6/bits/stl_construct.h:127
12 0x083f6196 in std::_Destroy<boost::intrusive_ptr<websocketpp::message::data>*, boost::intrusive_ptr<websocketpp::message::data> > (
    __first=0x966d2f0, __last=0x966d2f8) at /usr/include/c++/4.6/bits/stl_construct.h:153
13 0x083f9337 in std::deque<boost::intrusive_ptr<websocketpp::message::data>, std::allocator<boost::intrusive_ptr<websocketpp::message::data> > >::_M_destroy_data_aux (this=0x96697e0, __first=..., __last=...) at /usr/include/c++/4.6/bits/deque.tcc:797
14 0x083f60bf in std::deque<boost::intrusive_ptr<websocketpp::message::data>, std::allocator<boost::intrusive_ptr<websocketpp::message::data> > >::_M_destroy_data (this=0x96697e0, __first=..., __last=...) at /usr/include/c++/4.6/bits/stl_deque.h:1816
15 0x083f26cb in std::deque<boost::intrusive_ptr<websocketpp::message::data>, std::allocator<boost::intrusive_ptr<websocketpp::message::data> > >::~deque (this=0x96697e0, __in_chrg=<optimized out>) at /usr/include/c++/4.6/bits/stl_deque.h:898
16 0x083ef1d9 in std::queue<boost::intrusive_ptr<websocketpp::message::data>, std::deque<boost::intrusive_ptr<websocketpp::message::data>, std::allocator<boost::intrusive_ptr<websocketpp::message::data> > > >::~queue (this=0x96697e0, __in_chrg=<optimized out>)
    at /usr/include/c++/4.6/bits/stl_queue.h:92
17 0x083f9587 in websocketpp::message::pool<websocketpp::message::data>::~pool (this=0x96697d0, __in_chrg=<optimized out>)
    at /usr/local/include/websocketpp/roles/../processors/../messages/data.hpp:71
18 0x083f6339 in boost::checked_delete<websocketpp::message::pool<websocketpp::message::data> > (x=0x96697d0)
    at /usr/include/boost/checked_delete.hpp:34
19 0x0841448a in boost::detail::sp_counted_impl_p<websocketpp::message::pool<websocketpp::message::data> >::dispose (this=0x966b8d0)
    at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78
20 0x08356a7e in boost::detail::sp_counted_base::release (this=0x966b8d0) at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:145
21 0x08356ae2 in boost::detail::shared_count::~shared_count (this=0xbf9a4f94, __in_chrg=<optimized out>)
    at /usr/include/boost/smart_ptr/detail/shared_count.hpp:305
22 0x083e8d64 in boost::shared_ptr<websocketpp::message::pool<websocketpp::message::data> >::~shared_ptr (this=0xbf9a4f90, 
    __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/shared_ptr.hpp:164
23 0x083ed3ef in websocketpp::endpoint<websocketpp::role::server, websocketpp::socket::plain, websocketpp::log::logger>::~endpoint (
---Type <return> to continue, or q <return> to quit---
    this=0xbf9a4efc, __in_chrg=<optimized out>) at /usr/local/include/websocketpp/endpoint.hpp:169
24 0x083e5e2c in CORE::WSServer::~WSServer (this=0xbf9a4ee0, __in_chrg=<optimized out>)
    at /home/ky/Desktop/blitz/server/coroutine-app-server/common/src/WSServer.cpp:34

Looks like double mutex destructor call. But i really can't understand how could this happen.
Crash happens only after creating successfully handshaked connection and client-server data exchanging.

@maxim-ky
Copy link
Author

I found source of this crash.
It wasn't double mutex destruction but destruction of locked mutex.

Please apply this patch to master branch:
data.hpp:232+lock.unlock();

@zaphoyd
Copy link
Owner

zaphoyd commented Apr 13, 2012

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants