rtorrent crashes on FreeBSD 14.1

Hi,

I built FreeBSD 14.1 from source using GENERIC config, then rebuilt whole ports tree, and now rtorrent crashes like this, what can be the reason for this? rtorrent has behaved nicely for years, but now is a sad puppy…

Code:
❯ rtorrent
Caught Illegal instruction, dumping stack:
0x280d90 <_ZTVN7torrent14resource_errorE+0x3c498> at /usr/local/bin/rtorrent
0x827e4f410 <pthread_sigmask+0x540> at /lib/libthr.so.3
0x827e4e9cb <pthread_setschedparam+0x84b> at /lib/libthr.so.3
0x821cc62d3 <???> at ???
0x339d72 <_ZNK7torrent5Event9type_nameEv+0x7372> at /usr/local/bin/rtorrent
0x284882 <_ZN7torrent6ObjectC2ERKS0_+0x2312> at /usr/local/bin/rtorrent
0x286148 <_ZN7torrent6ObjectC2ERKS0_+0x3bd8> at /usr/local/bin/rtorrent
0x28bdd2 <_ZNK7torrent14internal_error4whatEv+0x1f62> at /usr/local/bin/rtorrent
0x335c72 <_ZNK7torrent5Event9type_nameEv+0x3272> at /usr/local/bin/rtorrent
0x337873 <_ZNK7torrent5Event9type_nameEv+0x4e73> at /usr/local/bin/rtorrent
0x33d51e <_ZNK7torrent5Event9type_nameEv+0xab1e> at /usr/local/bin/rtorrent
0x33d823 <_ZNK7torrent5Event9type_nameEv+0xae23> at /usr/local/bin/rtorrent
0x27faef <_ZTVN7torrent14resource_errorE+0x3b1f7> at /usr/local/bin/rtorrent
0x82c242a6a <__libc_start1+0x12a> at /lib/libc.so.7
[1]    38053 abort      rtorrent

Code:
❯ uname -a
FreeBSD core24.grimstveit.no 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-10e31f094 CORE24 amd64

Code:
❯ pkg info|grep BitT|grep writt
libtorrent-0.13.8              BitTorrent Library written in C++
rtorrent-0.9.8                 BitTorrent Client written in C++
 
What's in /etc/make.conf?

Code:
Caught Illegal instruction
Seems to indicate things have been compiled using instructions that aren't suitable for your CPU.
 
Thank you for the reply and request for more information, SirDice! I'll try to answer as well as possible.

Code:
❯ cat /etc/make.conf
KERNCONFDIR=/root/kernconf
KERNCONF=CORE24
DEFAULT_VERSIONS+=python=3.11 python3=3.11
WRKDIRPREFIX=/usr/obj/ports

Code:
❯  grep -i cpu /var/run/dmesg.boot|head -2
CPU: AMD Ryzen 9 3900X 12-Core Processor             (3792.94-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 24 CPUs

Code:
❯ ls -lh /root/kernconf/CORE24
lrwxr-xr-x  1 root wheel   26B Jun  4 09:09 /root/kernconf/CORE24 -> /root/kernconf/CORE24-14.1

Code:
❯ grep cpu /root/kernconf/CORE24-14.1 | head -1
cpu             HAMMER

Anything else you need?
 
Oh. I am getting the illegal instruction with the package, on an AMD 4750U.

ETA: in the port, too. But I can't build the libtorrent port right now.
 
Thank you. It isn't printing all g++ lines but in those that it prints I don't see process-specific options. Even if that was the problem I would expect the package to break and the port to work.

What processor do you have, anyway?
Code:
❯  grep -i cpu /var/run/dmesg.boot|head -2
CPU: AMD Ryzen 9 3900X 12-Core Processor             (3792.94-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 24 CPUs

?
 
We almost have the same processor. But my Intel 11th gen also fails with illegal instruction. I'm afraid I have no time to debug this in the next days.

What is puzzling is how you got a package that works. Which FreeBSD version is that for?
 
Code:
CPU microcode: updated from 0xc2 to 0xf0
CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (4000.00-MHz K8-class CPU)

The port crashes as well here on 14.1.
I'm on latest in /etc/pkg/FreeBSD.conf - which probably mean that the package in compiled on 14.0.
 
EDITED: I have the same problem in another C++ program. Turns out that a failed assert in std:string raises its alarm by executing an illegal instruction deliberately. A bug was fixed. So the source code change is probably the way to go.
 
Last edited:
Is the FreeBSD port running off of `master`, or the five year old release that hasn't been updated in ages and backports from it?
 
cracauer@ Since I'm a noob with only some dev experience, can you give me a few steps outlining how I can use the patch to build and use it on my system? I build my fbsd box from src, both kernel and ports (portmaster).
 
Generally speaking (I don't use rtorrent so have no specific knowledge), if you have a patch for a FreeBSD port, you put it in the files directory for that port--so for rtorrent, it looks like it should go in /usr/ports/net-p2p/rtorrent/files/ and named something like patch-something.

As you build the port, if more than one file is being patched, it will ask file to patch. So you should know which files are being patched in which order.
For example, I use a patch for the dwm window manager, and the patch covers two files, config.def.h and dwm.c, in that order. So, when I build the port, it asks file to patch, I put in config.def.h as that's first, then file to patch, and I put in dwm.c. It goes very quickly.
I hope this helps, but if you're not in a rush wait for cracauer@ to answer. Obviously, they're a lot more knowledgeable than I am.
 
cracauer@ Since I'm a noob with only some dev experience, can you give me a few steps outlining how I can use the patch to build and use it on my system? I build my fbsd box from src, both kernel and ports (portmaster).

Code:
cd /usr/ports/net-p2p/rtorrent/
make patch
cd work/rtorrent-0.9.8/
patch < ~/diff # the diff I attached above
cd ../..
make
# now do a `make reinstall` or whatever suits your needs
 
Fine. I reproduced the SIGPIPE. Took several days of runtime. On 14.1. 15-current run is still ongoing with no problems.

Code:
(gdb) bt
#0  _sendto () at _sendto.S:4
#1  0x00000008273bba4d in __thr_sendto (s=191, m=0x387bf2282aa0, l=4, f=0, 
    t=0x0, tl=0) at /xcarb3/usr/src/lib/libthr/thread/thr_syscalls.c:529
#2  0x00000008235491b7 in ?? () from /usr/local/lib/libtorrent.so.21
#3  0x000000082355a0dc in ?? () from /usr/local/lib/libtorrent.so.21
#4  0x00000008234e5c5e in torrent::PollKQueue::perform() ()
   from /usr/local/lib/libtorrent.so.21
#5  0x00000008234e5dd9 in torrent::PollKQueue::do_poll(long, int) ()
   from /usr/local/lib/libtorrent.so.21
#6  0x000000082351c112 in torrent::thread_base::event_loop(torrent::thread_base*) () from /usr/local/lib/libtorrent.so.21
#7  0x00000000002808ed in ?? ()
#8  0x000000082a39bbea in __libc_start1 (argc=26, argv=0x820cc8ec0, 
    env=0x820cc8f98, cleanup=<optimized out>, mainX=0x27f650)
    at /xcarb3/usr/src/lib/libc/csu/libc_start1.c:157
#9  0x000000000027e6a0 in ?? ()

Not too meaningful...
 
Back
Top