rakshasa / libtorrent

libTorrent BitTorrent library
http://rtorrent.net/downloads/
GNU General Public License v2.0
885 stars 209 forks source link

Segfault related to threading problems on Solaris 11 (GCC 7.2) #170

Open TheBloke opened 6 years ago

TheBloke commented 6 years ago

Hi

I'm trying to build rtorrent 0.9.6 and libtorrent 0.13.6 on Solaris 11.3 using GCC 7.2.

I can get it built and the UI works OK, but whenever a torrent starts to download rtorrent quickly segfaults with the errors such as these (two outputs from two runs shown):

tomj@net1:\~ $ /opt/lsw/bin/rtorrent
Caught Segmentation fault, dumping stack:
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_Z8do_panici+0x95 [0x4e70a5]
/lib/amd64/libc.so.1'__sighndlr+0x6 [0xffff80ffab717f76]
/lib/amd64/libc.so.1'call_user_handler+0x2ce [0xffff80ffab70afce]
[0x134c9d]
/lib/amd64/libc.so.1'_SUNW_Unwind_Resume+0x90 [0xffff80ffab71ff90]
/opt/lsw/stack/tools/libtorrent-0.13.6/lib/libtorrent.so.19.0.0'_ZN7torrent12download_addEPNS_6ObjectE+0x5af [0xffff80ffa9ca9aaf]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_ZN4core12DownloadList6createEPN7torrent6ObjectEb+0x1b [0x57ceab]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_ZN4core15DownloadFactory15receive_successEv+0x1bc9 [0x578ac9]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_ZN4core15DownloadFactory12receive_loadEv+0xc5b [0x57a86b]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_ZL14client_performv+0x103 [0x4e85a3]
/opt/lsw/stack/tools/libtorrent-0.13.6/lib/libtorrent.so.19.0.0'_ZN7torrent11thread_base10event_loopEPS0_+0x12e [0xffff80ffa9cdc8be]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'main+0x2862 [0x5dc5c2]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_start+0x6c [0x4e69ec]
Abort (core dumped)

tomj@net1:\~ $ /opt/lsw/bin/rtorrent
Caught Segmentation fault, dumping stack:
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_Z8do_panici+0x95 [0x4e70a5]
/lib/amd64/libc.so.1'__sighndlr+0x6 [0xffff80ffab717f76]
/lib/amd64/libc.so.1'call_user_handler+0x2ce [0xffff80ffab70afce]
/opt/lsw/stack/tools/libtorrent-0.13.6/lib/libtorrent.so.19.0.0'_ZN7torrent11TrackerList20disown_all_includingEi+0x23 [0xffff80ffa9cade63]
/opt/lsw/stack/tools/libtorrent-0.13.6/lib/libtorrent.so.19.0.0'_ZN7torrent17TrackerController5closeEi+0x2d [0xffff80ffa9caafdd]
/opt/lsw/stack/tools/libtorrent-0.13.6/lib/libtorrent.so.19.0.0'_ZN7torrent15DownloadWrapperD1Ev+0x35 [0xffff80ffa9d11ee5]
/opt/lsw/stack/tools/libtorrent-0.13.6/lib/libtorrent.so.19.0.0'_ZN7torrent12download_addEPNS_6ObjectE+0x59a [0xffff80ffa9ca9a9a]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_ZN4core12DownloadList6createEPN7torrent6ObjectEb+0x1b [0x57ceab]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_ZN4core15DownloadFactory15receive_successEv+0x1bc9 [0x578ac9]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_ZL14client_performv+0x103 [0x4e85a3]
/opt/lsw/stack/tools/libtorrent-0.13.6/lib/libtorrent.so.19.0.0'_ZN7torrent11thread_base10event_loopEPS0_+0x12e [0xffff80ffa9cdc8be]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'main+0x2862 [0x5dc5c2]
/opt/lsw/stack/tools/rtorrent-0.9.6/bin/rtorrent'_start+0x6c [0x4e69ec]
Abort (core dumped)

I am configuring libtorrent with the following command: OPENSSL_CFLAGS="-I/usr/include/openssl" OPENSSL_LIBS="-L/usr/lib/amd64" CFLAGS="-m64" CPPFLAGS="-m64" PATH=/opt/lsw/stack/tools/gcc/bin:/opt/lsw/bin:/usr/bin:/usr/sbin ARCH="-m64" ./configure --prefix=/opt/lsw/stack/tools/libtorrent-0.13.6

And rtorrent with the following: libtorrent_CFLAGS="-I/opt/lsw/include" libtorrent_LIBS="-L/opt/lsw/lib -ltorrent" CFLAGS="-I/opt/lsw/include -I/usr/include/ncurses -m64" CPPFLAGS="-I/opt/lsw/include -I/usr/include/ncurses -m64" LDFLAGS="-lsocket -lnsl" PATH=/opt/lsw/stack/tools/gcc/bin:/opt/lsw/bin:/usr/bin:/usr/sbin ARCH="-m64" ./configure --prefix=/opt/lsw/stack/tools/rtorrent-0.9.6

(/opt/lsw/lib and /opt/lsw/include contains symlinks to the appropriate files in /opt/lsw/stack/tools/libtorrent-0.13.6)

Here is a Gist containing config.log for libtorrent-0.13.6 and rtorrent-0.9.6: https://gist.github.com/TheBloke/20c982f0cedb57c377a12a6841f9ebb0

I realise Solaris is not going to be a priority platform, but I would be grateful for any help in diagnosing and potentially fixing the issue. I have a working copy of rtorrent 0.8.6, built by the Solaris dev team. But none of the advanced config examples I am seeing for rtorrent.rc work on the older 0.8.6.

Let me know if I can provide any further info.

Thanks in advance.

chros73 commented 6 years ago

Just out of curiosity, can you build rtorrent-ps-ch ?

TheBloke commented 6 years ago

@chros73 I will try now. Before looking at rtorrent I did briefly investigate rtorrent-ps-PS-1.0 but its build system looked very Linux-specific so I thought I'd try vanilla first.

I'll go try ps-ch now. Thanks.

chros73 commented 6 years ago

If ps-ch won't work for whatever reason then try ps, its building system slightly different.

TheBloke commented 6 years ago

OK thanks, I am looking at them now.

So do you think rtorrent-ps-* might work better on Solaris than rtorrent?

chros73 commented 6 years ago

@pyroscope coupled couple of libraries into it, that's why I think it can behave better. The biggest problem for you can be to figure out what packages it needs to be able to compile.