{"action":"opened","issue":{"url":"https://api.github.com/repos/arvidn/libtorrent/issues/266","labels_url":"https://api.github.com/repos/arvidn/libtorrent/issues/266/labels{/name}","comments_url":"https://api.github.com/repos/arvidn/libtorrent/issues/266/comments","events_url":"https://api.github.com/repos/arvidn/libtorrent/issues/266/events","html_url":"https://github.com/arvidn/libtorrent/issues/266","id":116820596,"number":266,"title":"'ec != error::invalid_argument || !m_outgoing' assertion failure","user":{"login":"NormalRa","id":2751480,"avatar_url":"https://avatars.githubusercontent.com/u/2751480?v=3","gravatar_id":"","url":"https://api.github.com/users/NormalRa","html_url":"https://github.com/NormalRa","followers_url":"https://api.github.com/users/NormalRa/followers","following_url":"https://api.github.com/users/NormalRa/following{/other_user}","gists_url":"https://api.github.com/users/NormalRa/gists{/gist_id}","starred_url":"https://api.github.com/users/NormalRa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NormalRa/subscriptions","organizations_url":"https://api.github.com/users/NormalRa/orgs","repos_url":"https://api.github.com/users/NormalRa/repos","events_url":"https://api.github.com/users/NormalRa/events{/privacy}","received_events_url":"https://api.github.com/users/NormalRa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-13T18:15:34Z","updated_at":"2015-11-13T18:15:34Z","closed_at":null,"body":"Hello, me again!\r\n\r\nMy recent BitTorrent endeavours resulted in Deluge crashing immediately on start with the following message:\r\n```\r\ndeluged[690]: assertion failed. Please file a bugreport at https://github.com/arvidn/libtorrent/issues\r\ndeluged[690]: Please include the following information:\r\ndeluged[690]: version: 1.0.6.0\r\ndeluged[690]: $Rev$\r\ndeluged[690]: file: 'peer_connection.cpp'\r\ndeluged[690]: line: 3557\r\ndeluged[690]: function: virtual void libtorrent::peer_connection::disconnect(const boost::system::error_code&, int)\r\ndeluged[690]: expression: ec != error::invalid_argument || !m_outgoing\r\ndeluged[690]: stack:\r\nsystemd[1]: deluged.service: Main process exited, code=killed, status=6/ABRT\r\nsystemd[1]: deluged.service: Unit entered failed state.\r\nsystemd[1]: deluged.service: Failed with result 'signal'.\r\n```\r\n\r\nAs [mentioned](https://github.com/arvidn/libtorrent/issues/207#issuecomment-150785108), my libtorrent is built with **ASan** which reports the following backtrace:\r\n```\r\n\r\nThread 4 (Thread 0x66aff430 (LWP 801)):\r\n#0  0x76897a14 in pthread_cond_wait@@GLIBC_2.4 () from /usr/lib/libpthread.so.0\r\nNo symbol table info available.\r\n#1  0x67d3d834 in boost::asio::detail::posix_event::wait<boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex> > (lock=..., this=0x7340d960) at /usr/include/boost/asio/detail/posix_event.hpp:106\r\nNo locals.\r\n#2  boost::asio::detail::task_io_service::do_run_one (this=this@entry=0x7340d930, lock=..., this_thread=..., ec=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:380\r\nNo locals.\r\n#3  0x67d3df94 in boost::asio::detail::task_io_service::run (this=0x7340d930, ec=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:149\r\n        this_thread = {<boost::asio::detail::thread_info_base> = {<boost::asio::detail::noncopyable> = {<No data fields>}, reusable_memory_ = 0x0}, private_op_queue = {<boost::asio::detail::noncopyable> = {<No data fields>}, front_ = 0x0, back_ = 0x0}, \r\n          private_outstanding_work = 0}\r\n        ctx = {<boost::asio::detail::noncopyable> = {<No data fields>}, key_ = 0x7340d930, value_ = 0x66afed20, next_ = 0x0}\r\n        lock = {<boost::asio::detail::noncopyable> = {<No data fields>}, mutex_ = @0x7340d948, locked_ = true}\r\n        n = 11\r\n#4  0x67d4944c in boost::asio::io_service::run (this=0x74c5b230) at /usr/include/boost/asio/impl/io_service.ipp:59\r\n        s = <optimized out>\r\n#5  0x67d495a0 in boost::asio::detail::resolver_service_base::work_io_service_runner::operator() (this=0x74c5b754) at /usr/include/boost/asio/detail/impl/resolver_service_base.ipp:32\r\nNo locals.\r\n#6  boost::asio::detail::posix_thread::func<boost::asio::detail::resolver_service_base::work_io_service_runner>::run (this=0x74c5b750) at /usr/include/boost/asio/detail/posix_thread.hpp:82\r\nNo locals.\r\n#7  boost::asio::detail::boost_asio_detail_posix_thread_function (arg=0x74c5b750) at /usr/include/boost/asio/detail/impl/posix_thread.ipp:64\r\n        func = <optimized out>\r\n#8  0x76890f98 in start_thread () from /usr/lib/libpthread.so.0\r\nNo symbol table info available.\r\n#9  0x7681a640 in ?? () from /usr/lib/libc.so.6\r\nNo symbol table info available.\r\nBacktrace stopped: previous frame identical to this frame (corrupt stack?)\r\n\r\nThread 3 (Thread 0x76fac000 (LWP 690)):\r\n(snip, not particularly helpful message repeats lots of times)\r\n\r\nThread 2 (Thread 0x67c68430 (LWP 797)):\r\n#0  0x6f5bc83c in sha1_block_data_order_neon () from /usr/lib/libcrypto.so.1.0.0\r\nNo symbol table info available.\r\n#1  0x67c67144 in ?? ()\r\nNo symbol table info available.\r\nBacktrace stopped: previous frame identical to this frame (corrupt stack?)\r\n\r\nThread 1 (Thread 0x67468430 (LWP 798)):\r\n#0  0x767777f0 in raise () from /usr/lib/libc.so.6\r\nNo symbol table info available.\r\n#1  0x76778b98 in abort () from /usr/lib/libc.so.6\r\nNo symbol table info available.\r\n#2  0x67d5ca78 in assert_fail (expr=0x68555c80 \"ec != error::invalid_argument || !m_outgoing\", line=line@entry=3557, file=0x76888080 <lock> \"\", function=0x1 <error: Cannot access memory at address 0x1>, value=0x6854af60 \"\", kind=0) at assert.cpp:267\r\n        out = 0x67468430\r\n        stack = <error reading variable stack (Cannot access memory at address 0xffffdfc2)>\r\n        message = <optimized out>\r\n#3  0x67fdd194 in libtorrent::peer_connection::disconnect (this=0x7440bd80, ec=..., error=<optimized out>) at peer_connection.cpp:3557\r\n        __PRETTY_FUNCTION__ = \"virtual void libtorrent::peer_connection::disconnect(const boost::system::error_code&, int)\"\r\n        me = <optimized out>\r\n        _invariant_check = <optimized out>\r\n        e = <optimized out>\r\n#4  0x67fa113c in libtorrent::peer_connection::connect_failed (this=this@entry=0x7440bd80, e=...) at peer_connection.cpp:3492\r\n        t = {px = 0x71e21480, pn = {pi_ = 0x65504690}}\r\n        __PRETTY_FUNCTION__ = \"void libtorrent::peer_connection::connect_failed(const boost::system::error_code&)\"\r\n        t = {px = 0x71e21480, pn = {pi_ = 0x65504690}}\r\n#5  0x67fd55a4 in libtorrent::peer_connection::on_connection_complete (this=0x7440bd80, e=...) at peer_connection.cpp:5605\r\n        completed = <optimized out>\r\n        __PRETTY_FUNCTION__ = \"void libtorrent::peer_connection::on_connection_complete(const boost::system::error_code&)\"\r\n        _invariant_check = @0x67dae974: {<No data fields>}\r\n#6  0x6844d52c in boost::function1<void, boost::system::error_code const&>::operator() (a0=..., this=0x67467aa0) at /usr/include/boost/function/function_template.hpp:771\r\nNo locals.\r\n#7  boost::_bi::list1<boost::_bi::value<boost::system::error_code> >::operator()<boost::function1<void, boost::system::error_code const&>, boost::_bi::list0> (a=<synthetic pointer>, f=..., this=0x67467ab0) at /usr/include/boost/bind/bind.hpp:255\r\nNo locals.\r\n#8  boost::_bi::bind_t<void, boost::function1<void, boost::system::error_code const&>, boost::_bi::list1<boost::_bi::value<boost::system::error_code> > >::operator() (this=0x67467aa0) at /usr/include/boost/bind/bind_template.hpp:20\r\nNo locals.\r\n#9  boost::asio::asio_handler_invoke<boost::_bi::bind_t<void, boost::function1<void, boost::system::error_code const&>, boost::_bi::list1<boost::_bi::value<boost::system::error_code> > > > (function=...) at /usr/include/boost/asio/handler_invoke_hook.hpp:69\r\nNo locals.\r\n#10 boost_asio_handler_invoke_helpers::invoke<boost::_bi::bind_t<void, boost::function1<void, boost::system::error_code const&>, boost::_bi::list1<boost::_bi::value<boost::system::error_code> > >, boost::_bi::bind_t<void, boost::function1<void, boost::system::error_code const&>, boost::_bi::list1<boost::_bi::value<boost::system::error_code> > > > (context=..., function=...) at /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:37\r\nNo locals.\r\n#11 boost::asio::detail::completion_handler<boost::_bi::bind_t<void, boost::function1<void, boost::system::error_code const&>, boost::_bi::list1<boost::_bi::value<boost::system::error_code> > > >::do_complete (owner=0x7340d860, owner@entry=0x0, \r\n    base=base@entry=0x659af650) at /usr/include/boost/asio/detail/completion_handler.hpp:68\r\n        b = {<boost::asio::detail::noncopyable> = {<No data fields>}, value_ = 1}\r\n        h = 0x659af650\r\n        p = {h = 0x67467aa0, v = 0x0, p = 0x0}\r\n        handler = {f_ = {<boost::function_base> = {\r\n              vtable = 0x685f1ff0 <void boost::function1<void, boost::system::error_code const&>::assign_to<boost::_bi::bind_t<void, boost::_mfi::mf1<void, libtorrent::peer_connection, boost::system::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::intrusive_ptr<libtorrent::peer_connection> >, boost::arg<1> > > >(boost::_bi::bind_t<void, boost::_mfi::mf1<void, libtorrent::peer_connection, boost::system::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::intrusive_ptr<libtorrent::peer_connection> >, boost::arg<1> > >)::stored_vtable>, functor = {obj_ptr = 0x67fd4fe8 <libtorrent::peer_connection::on_connection_complete(boost::system::error_code const&)>, type = {\r\n                  type = 0x67fd4fe8 <libtorrent::peer_connection::on_connection_complete(boost::system::error_code const&)>, const_qualified = false, volatile_qualified = false}, \r\n                func_ptr = 0x67fd4fe8 <libtorrent::peer_connection::on_connection_complete(boost::system::error_code const&)>, bound_memfunc_ptr = {memfunc_ptr = (void (boost::detail::function::X::*)(boost::detail::function::X * const, \r\n    int)) 0x67fd4fe8 <libtorrent::peer_connection::on_connection_complete(boost::system::error_code const&)>, obj_ptr = 0x7440bd80}, obj_ref = {obj_ptr = 0x67fd4fe8 <libtorrent::peer_connection::on_connection_complete(boost::system::error_code const&)>, \r\n                  is_const_qualified = false, is_volatile_qualified = false}, data = 232 '\\350'}}, <std::unary_function<boost::system::error_code const&, void>> = {<No data fields>}, static args = <optimized out>, static arity = <optimized out>}, \r\n          l_ = {<boost::_bi::storage1<boost::_bi::value<boost::system::error_code> >> = {a1_ = {t_ = {m_val = 22, m_cat = 0x7392407c}}}, <No data fields>}}\r\n#12 0x67d3db00 in boost::asio::detail::task_io_service_operation::complete (bytes_transferred=0, ec=..., owner=..., this=0x659af650) at /usr/include/boost/asio/detail/task_io_service_operation.hpp:38\r\nNo locals.\r\n#13 boost::asio::detail::task_io_service::do_run_one (this=this@entry=0x7340d860, lock=..., this_thread=..., ec=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:372\r\n        task_result = 0\r\n        on_exit = {task_io_service_ = 0x7340d860, lock_ = 0x67467c20, this_thread_ = 0x67467ca0}\r\n        more_handlers = <optimized out>\r\n#14 0x67d3df94 in boost::asio::detail::task_io_service::run (this=0x7340d860, ec=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:149\r\n        this_thread = {<boost::asio::detail::thread_info_base> = {<boost::asio::detail::noncopyable> = {<No data fields>}, reusable_memory_ = 0x0}, private_op_queue = {<boost::asio::detail::noncopyable> = {<No data fields>}, front_ = 0x0, back_ = 0x0}, \r\n          private_outstanding_work = 0}\r\n        ctx = {<boost::asio::detail::noncopyable> = {<No data fields>}, key_ = 0x7340d860, value_ = 0x67467ca0, next_ = 0x0}\r\n        lock = {<boost::asio::detail::noncopyable> = {<No data fields>}, mutex_ = @0x7340d878, locked_ = false}\r\n        n = 922\r\n#15 0x67d3e298 in boost::asio::io_service::run (this=this@entry=0x740abc60, ec=...) at /usr/include/boost/asio/impl/io_service.ipp:66\r\nNo locals.\r\n#16 0x68170274 in libtorrent::aux::session_impl::main_thread (this=0x740ab900) at session_impl.cpp:4885\r\n        ec = {m_val = 0, m_cat = 0x7392407c}\r\n        __PRETTY_FUNCTION__ = \"void libtorrent::aux::session_impl::main_thread()\"\r\n        stop_loop = false\r\n#17 0x67d495f0 in boost::asio::detail::boost_asio_detail_posix_thread_function (arg=0x74c5b2d0) at /usr/include/boost/asio/detail/impl/posix_thread.ipp:64\r\n        func = <optimized out>\r\n#18 0x76890f98 in start_thread () from /usr/lib/libpthread.so.0\r\nNo symbol table info available.\r\nBacktrace stopped: Cannot access memory at address 0x8\r\n```\r\n\r\nI have a feeling this is not particularly helpful, but I'm willing to assist in the debug process in case more detailed traces are needed.\r\n\r\nThank you!"}}