Sporadic SIGSEGV when USB drive is unplugged
Firstly, thank you so much for this brilliant little project. It's exactly the kind of stuff we need on the FreeBSD desktop. And with C++ and Qt, your code is so much simpler and clearer than the original UDisks code.
With FreeBSD 12.2, gvfs 1.46.1_2 and bsdisks 0.24 from packages, I got bsdisks to work and it worked well. After some time, however, it crashed, apparently when one of the drives was unplugged:
Feb 16 18:47:41 freebsd kernel: da1: 40.000MB/s transfers
Feb 16 18:47:41 freebsd kernel: da1: Attempt to query device size failed: UNIT ATTENTION, Not ready to ready change, medium may have changed
Feb 16 18:47:41 freebsd kernel: da1: quirks=0x2<NO_6_BYTE>
Feb 16 18:48:09 freebsd kernel: ugen0.7: <TOSHIBA TransMemory> at usbus0 (disconnected)
Feb 16 18:48:09 freebsd kernel: umass2: at uhub2, port 5, addr 10 (disconnected)
Feb 16 18:48:09 freebsd kernel: (da1:umass-sim2:2:0:0): got CAM status 0x44
Feb 16 18:48:09 freebsd kernel: (da1:umass-sim2:2:0:0): fatal error, failed to attach to device
Feb 16 18:48:09 freebsd kernel: da1 at umass-sim2 bus 2 scbus7 target 0 lun 0
Feb 16 18:48:09 freebsd kernel: da1: < > s/n 8D7A69E642A1CE50FD40C35F detached
Feb 16 18:48:09 freebsd kernel: g_access(961): provider da1 has error 6 set
Feb 16 18:48:09 freebsd kernel: (da1:umass-sim2:2:0:0): Periph destroyed
Feb 16 18:48:09 freebsd kernel: umass2: detached
Feb 16 18:48:10 freebsd kernel: pid 38400 (bsdisks), jid 0, uid 0: exited on signal 11 (core dumped)
Feb 16 18:48:11 freebsd devd[66156]: notify_clients: send() failed; dropping unresponsive client
The core dump isn't very revealing:
Core was generated by `/usr/local/bin/bsdisks --no-debug --syslog-output'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000800876af0 in ?? ()
[Current thread is 1 (LWP 102418)]
(gdb) bt
#0 0x0000000800876af0 in ?? ()
#1 0x000000080449fd20 in ?? ()
#2 0x000000080446d620 in ?? ()
#3 0x0000000000000074 in ?? ()
#4 0x0000000000000009 in ?? ()
#5 0x000000080094f2a8 in ?? ()
#6 0x000000080094f600 in ?? ()
#7 0x00007fffffffe448 in ?? ()
#8 0x0000000000b3b590 in ?? ()
#9 0x03d66feea11c9564 in ?? ()
#10 0x0000000000000008 in ?? ()
#11 0x0000000801992a40 in ?? ()
#12 0x0000000000000017 in ?? ()
#13 0x03d66feea11c9564 in ?? ()
#14 0x0000000803b5b400 in ?? ()
#15 0x0000000800925718 in ?? ()
#16 0x00007fffffffe448 in ?? ()
#17 0x000000080446d620 in ?? ()
#18 0x00007fffffffe450 in ?? ()
#19 0x00007fffffffe410 in ?? ()
#20 0x0000000800876934 in ?? ()
#21 0x0000000000000083 in ?? ()
#22 0x0000000000000000 in ?? ()
I also did "thread apply all bt", but of the 7 threads, none had debug symbols.
Let me see if I can reproduce it.