frostalf / libtorrent

Automatically exported from code.google.com/p/libtorrent
0 stars 0 forks source link

Segmentation fault at libtorrent::network_thread_pool::process_job #583

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./libtorrent-daemon --cache-type=0 --utp 
--cache-size=48000 --aio-threads=8 --network-th'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000006e1a21 in boost::asio::detail::epoll_reactor::start_op(int, 
int, boost::asio::detail::epoll_reactor::descriptor_state*&, 
boost::asio::detail::reactor_op*, bool, bool) ()
(gdb) bt
#0  0x00000000006e1a21 in boost::asio::detail::epoll_reactor::start_op(int, 
int, boost::asio::detail::epoll_reactor::descriptor_state*&, 
boost::asio::detail::reactor_op*, bool, bool) ()
#1  0x0000000000746558 in void 
boost::asio::detail::reactive_socket_service_base::async_receive<boost::asio::mu
table_buffers_1, 
libtorrent::peer_connection::allocating_handler<boost::_bi::bind_t<void, 
boost::_mfi::mf2<void, libtorrent::peer_connection, boost::system::error_code 
const&, unsigned long>, 
boost::_bi::list3<boost::_bi::value<boost::shared_ptr<libtorrent::peer_connectio
n> >, boost::arg<1>, boost::arg<2> > >, 336ul> 
>(boost::asio::detail::reactive_socket_service_base::base_implementation_type&, 
boost::asio::mutable_buffers_1 const&, int, 
libtorrent::peer_connection::allocating_handler<boost::_bi::bind_t<void, 
boost::_mfi::mf2<void, libtorrent::peer_connection, boost::system::error_code 
const&, unsigned long>, 
boost::_bi::list3<boost::_bi::value<boost::shared_ptr<libtorrent::peer_connectio
n> >, boost::arg<1>, boost::arg<2> > >, 336ul>) ()
#2  0x0000000000746644 in 
boost::asio::async_result<boost::asio::handler_type<libtorrent::peer_connection:
:allocating_handler<boost::_bi::bind_t<void, boost::_mfi::mf2<void, 
libtorrent::peer_connection, boost::system::error_code const&, unsigned long>, 
boost::_bi::list3<boost::_bi::value<boost::shared_ptr<libtorrent::peer_connectio
n> >, boost::arg<1>, boost::arg<2> > >, 336ul>, void 
(boost::system::error_code, unsigned long)>::type>::type 
boost::asio::stream_socket_service<boost::asio::ip::tcp>::async_receive<boost::a
sio::mutable_buffers_1, 
libtorrent::peer_connection::allocating_handler<boost::_bi::bind_t<void, 
boost::_mfi::mf2<void, libtorrent::peer_connection, boost::system::error_code 
const&, unsigned long>, 
boost::_bi::list3<boost::_bi::value<boost::shared_ptr<libtorrent::peer_connectio
n> >, boost::arg<1>, boost::arg<2> > >, 336ul> 
>(boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::implementa
tion_type&, boost::asio::mutable_buffers_1 const&, int, 
libtorrent::peer_connection::allocating_handler<boost::_bi::bind_t<void, 
boost::_mfi::mf2<void, libtorrent::peer_connection, boost::system::error_code 
const&, unsigned long>, 
boost::_bi::list3<boost::_bi::value<boost::shared_ptr<libtorrent::peer_connectio
n> >, boost::arg<1>, boost::arg<2> > >, 336ul> const&) ()
#3  0x0000000000731b39 in 
libtorrent::network_thread_pool::process_job(libtorrent::socket_job const&, 
bool) ()
#4  0x000000000073a8d6 in 
libtorrent::thread_pool<libtorrent::socket_job>::thread_fun(int) ()
#5  0x00000000006d8257 in boost_asio_detail_posix_thread_function ()
#6  0x00007fd33918db50 in start_thread () from 
/lib/x86_64-linux-gnu/libpthread.so.0
#7  0x00007fd3380be0ed in clone () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000000000000000 in ?? ()

Original issue reported on code.google.com by v.korkod...@gmail.com on 14 Feb 2014 at 6:34

GoogleCodeExporter commented 9 years ago
it appears that boost.asio on linux does not support async_read() and 
async_write() on sockets from other threads than their io_service. so 
unfortunately you cannot use > 0 network threads. It appears to work on macos, 
but if it's a race condition that could just be a coincidence.

Original comment by arvid.no...@gmail.com on 14 Feb 2014 at 9:15

GoogleCodeExporter commented 9 years ago
It worked prior to patch http://sourceforge.net/p/libtorrent/code/9646/

Original comment by v.korkod...@gmail.com on 14 Feb 2014 at 3:14

GoogleCodeExporter commented 9 years ago
and you may notice the relevant parts of that patch:

+SET(network_threads, 1, &session_impl::update_network_threads),

+set.set_int(settings_pack::network_threads, 5);

+m_net_thread_pool.back()->set_num_threads(1);

Original comment by arvid.no...@gmail.com on 15 Feb 2014 at 2:16

GoogleCodeExporter commented 9 years ago
I've reverted those parts now.

Original comment by arvid.no...@gmail.com on 15 Feb 2014 at 2:32

GoogleCodeExporter commented 9 years ago
I've reverted only "+m_net_thread_pool.back()->set_num_threads(1);"
Segfault disappeared.
I use 2-4 network threads

Original comment by v.korkod...@gmail.com on 15 Feb 2014 at 4:17