Bug 248531 - sysutils/bsdisks: core dump when ejecting FAT-formatted SD card
Summary: sysutils/bsdisks: core dump when ejecting FAT-formatted SD card
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Gleb Popov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-08 08:05 UTC by Martin Birgmeier
Modified: 2020-08-19 15:52 UTC (History)
0 users

See Also:
arrowd: maintainer-feedback+


Attachments
current bsdisks.log (18.40 KB, text/plain)
2020-08-09 07:35 UTC, Martin Birgmeier
no flags Details
grep bsdisks /var/log/debug.log (85.60 KB, text/plain)
2020-08-09 07:37 UTC, Martin Birgmeier
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2020-08-08 08:05:40 UTC
Scenario:
- FreeBSD 12.1-RELEASE-p6 amd64
- ports at r544332 (compiled using portmaster)
- x11/kde5 installed
- bsdisks-0.18 installed (is a dependency of x11/kde5)
- FAT-formatted SD card
- There is an entry for this SD card in /etc/fstab (using noauto)
- Inserting SD card
- "mount <SD card mountpoint>"
- "umount <SD card mountpoint>"

Result:
- bsdisks dumps core (in /) when the umount command is issued

Expected result:
- bsdisks continues running
Comment 1 commit-hook freebsd_committer 2020-08-08 09:31:50 UTC
A commit references this bug:

Author: arrowd
Date: Sat Aug  8 09:31:26 UTC 2020
New revision: 544374
URL: https://svnweb.freebsd.org/changeset/ports/544374

Log:
  sysutils/bsdisks: Update to 0.19. Brings a MMC-related fix.

  PR:		248531

Changes:
  head/sysutils/bsdisks/Makefile
  head/sysutils/bsdisks/distinfo
Comment 2 Gleb Popov freebsd_committer 2020-08-08 09:33:37 UTC
Please, try a new version. If the crash persist, some logs would be helpful. Note that since 0.17 bsdisks supports logging into syslog.
Comment 3 Martin Birgmeier 2020-08-08 11:43:40 UTC
Thank you for the quick fix. In fact I wanted to try it immediately, but svn.freebsd.org seems to be not syncing from its master since several hours, so I can't get the latest ports tree.

-- Martin
Comment 4 Martin Birgmeier 2020-08-08 11:49:44 UTC
One more thing about syslog... I have seen the changelog but don't know how to enable it. "man bsdisks.conf" does not mention syslog. And how is bsdisks being started? It's all a bit mysterious if one is not familiar with its Linux equivalent which it seems to emulate.

-- Martin
Comment 5 Gleb Popov freebsd_committer 2020-08-08 11:55:22 UTC
(In reply to Martin Birgmeier from comment #4)
> One more thing about syslog... I have seen the changelog but don't know how to enable it. "man bsdisks.conf" does not mention syslog.

I don't use syslog myself, but if I understand it right, it should work out of the box. The port installs sample config files for syslogd, which should be automatically picked up.

> And how is bsdisks being started? It's all a bit mysterious if one is not familiar with its Linux equivalent which it seems to emulate.

There is nothing Linux-specific. It is started by D-Bus daemon whenever some application make a request to org.freedesktop.UDisks2. It should be described in the man page, I think.
Comment 6 Martin Birgmeier 2020-08-08 12:10:21 UTC
O.k., I see that bsdisks is being started with --syslog-output.

My question is just, what is starting bsdisks (and setting the command line parameters)? Can I see that in some configuration file?

-- Martin
Comment 7 Gleb Popov freebsd_committer 2020-08-08 12:20:59 UTC
(In reply to Martin Birgmeier from comment #6)
Like I said, it is started by D-Bus daemon.

bsdisks installs /usr/local/share/dbus-1/system-services/org.freedesktop.Udisks2.service file, which is loaded by D-Bus and instructs it to run "bsdisks" executable whenever objects or methods under org.freedesktop.Udisks2 namespace are requested.
Comment 8 Martin Birgmeier 2020-08-08 12:46:58 UTC
Thank you.

I should have seen that when looking at "pkg query %Fp bsdisks-0.18".

-- Martin
Comment 9 Martin Birgmeier 2020-08-09 07:32:13 UTC
I have just tried the scenario with the new bsdisks-0.19, but the core dump still happens on unmounting.

-- Martin
Comment 10 Martin Birgmeier 2020-08-09 07:35:16 UTC
Created attachment 217102 [details]
current bsdisks.log

Current bsdisks.log

It only starts with the new version because it was necessary to create /var/log/bsdisks.log first manually before syslogd would start using it.
Comment 11 Martin Birgmeier 2020-08-09 07:37:09 UTC
Created attachment 217105 [details]
grep bsdisks /var/log/debug.log

bsdisks entries are also in debug.log - these have a longer history.
Comment 12 Martin Birgmeier 2020-08-09 08:17:21 UTC
bsdisks also dumps core when unmounting USB sticks.

Maybe this helps: The difference of "find /dev" with and without the USB stick inserted (but not mounted).

122,124d121
< /dev/usb/0.8.0
< /dev/usb/0.8.1
< /dev/usb/0.8.2
144d140
< /dev/ntfs/disk54
191,193d186
< /dev/ugen0.8
< /dev/pass2
< /dev/da0
Comment 13 Martin Birgmeier 2020-08-09 08:18:43 UTC
Here the difference of "find /dev" without and with the SD card inserted (as in the original bug report):

189a190,196
> /dev/mmcsd0
> /dev/diskid
> /dev/diskid/DISK-70F7E534
> /dev/diskid/DISK-70F7E534s1
> /dev/mmcsd0s1
> /dev/msdosfs
> /dev/msdosfs/MBI_D7000
Comment 14 Gleb Popov freebsd_committer 2020-08-09 14:48:51 UTC
Okay, so this is unrelated with both storage type and fstab file. Maybe it has something to do with labels or partitioning.

Please provide an output of `gpart list` and `glabel list` for USB stick or SD card that are causing crash.
Comment 15 Martin Birgmeier 2020-08-09 15:02:55 UTC
Plugging in the USB stick, on the console:

[0]# ugen0.8: <vendor 0x13fe USB DISK 2.0> at usbus0
 on uhub5
<vendor 0x13fe USB DISK 2.0, class 0/0, rev 2.00/1.00, addr 8> on usbus0
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: < USB DISK 2.0 PMAP> Removable Direct Access SPC-2 SCSI device
da0: Serial Number 07BB14027B7A00FD
da0: 40.000MB/s transfers
da0: 30544MB (62554112 512 byte sectors)
da0: quirks=0x3<NO_SYNC_CACHE,NO_6_BYTE>
     
[0]# gpart list da0
gpart: Class 'PART' does not have an instance named 'da0'.
[1]# gpart list /dev/da0
gpart: Class 'PART' does not have an instance named '/dev/da0'.
[1]# glabel list /dev/da0
glabel: Class 'LABEL' does not have an instance named '/dev/da0'.

Plugging in the SD card, on the console:

[0]#  on sdhci_pci0
mmcsd0: 32GB <SDHC SD32G 8.0 SN 70F7E534 MFG 03/2011 by 3 SD> at mmc0 50.0MHz/4bit/65535-block

[0]# gpart list mmcsd0
Geom name: mmcsd0
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 62333951
first: 63
entries: 4
scheme: MBR
Providers:
1. Name: mmcsd0s1
   Mediasize: 31910789120 (30G)
   Sectorsize: 512
   Stripesize: 4194304
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,MBR,00000000,0x2000,0x3b70400)
   rawtype: 12
   length: 31910789120
   offset: 4194304
   type: fat32lba
   index: 1
   end: 62333951
   start: 8192
Consumers:
1. Name: mmcsd0
   Mediasize: 31914983424 (30G)
   Sectorsize: 512
   Stripesize: 4194304
   Stripeoffset: 0
   Mode: r0w0e0

[0]#
Comment 16 Gleb Popov freebsd_committer 2020-08-09 15:09:05 UTC
(In reply to Martin Birgmeier from comment #15)
Hum. I have no idea what's wrong.

Another thing to try is to compile bsdisks with debugging symbols:

# make -C /usr/ports/sysutils/bsdisks WITH_DEBUG=1 reinstall
# killall bsdisks ; bsdisks

Then `umount <your device>` and share the bsdisks crash message with me.
Comment 17 Martin Birgmeier 2020-08-09 15:33:35 UTC
Scenario:
- recompiled bsdisks using the given command
- verified that no bsdisks process was running
- started dolphin

Result:
- Two bsdisks processes running, one is the child of the other (not seen before, if I remember correctly there was always only one running):

[0]# pstree | grep bsdisks                                                                                                         
 |   \--- 30274 root grep bsdisks                                                                                                                                                                                                                                      
 |-+- 30248 root /usr/local/bin/bsdisks --no-debug --syslog-output                                                                                                                                                                                                     
 | \--- 30250 root /usr/local/bin/bsdisks --no-debug --syslog-output                                                                                                                                                                                                   
[0]# 

Scenario (continued):
- Inserted USB stick 54
- "mount /d/54"
- verified that no core dump produced yet
- "umount /d/54"

Result:
- core dump produced in /

[0]# lldb -c /bsdisks.core /usr/local/bin/bsdisks                                                                                  
(lldb) target create "/usr/local/bin/bsdisks" --core "/bsdisks.core"                                                               
Core file '/bsdisks.core' (x86_64) was loaded.                                                                                     
(lldb) thread list
Process 0 stopped
* thread #1: tid = 102388, 0x000000000026e544 bsdisks`std::__1::__bitset<1ul, 2ul>::all(this=0x0000000000000058) const at bitset:579:15, name = 'bsdisks', stop reason = signal SIGSEGV
  thread #2: tid = 101960, 0x0000000800b8f0da libc.so.7`__sys_poll + 10, name = 'bsdisks', stop reason = signal SIGSEGV
  thread #3: tid = 102073, 0x0000000800b7c8aa libc.so.7`_ppoll + 10, name = 'bsdisks', stop reason = signal SIGSEGV
  thread #4: tid = 102110, 0x0000000800e9bedc libthr.so.3`___lldb_unnamed_symbol190$$libthr.so.3 + 92, name = 'bsdisks', stop reason = signal SIGSEGV
  thread #5: tid = 102111, 0x0000000800b8f0b8 libc.so.7`__sys_recvfrom + 8, name = 'bsdisks', stop reason = signal SIGSEGV
  thread #6: tid = 102112, 0x0000000800e9bedc libthr.so.3`___lldb_unnamed_symbol190$$libthr.so.3 + 92, name = 'bsdisks', stop reason = signal SIGSEGV
  thread #7: tid = 102113, 0x0000000800bed6aa libc.so.7`__sysctl + 10, name = 'bsdisks', stop reason = signal SIGSEGV
(lldb) thread backtrace
error: bsdisks DWARF DW_TAG_array_type DIE at 0x003626b3 has a class/union/struct element type DIE 0x003626bf that is a forward declaration, not a complete definition.
Try compiling the source file with -fstandalone-debug or disable -gmodules
error: bsdisks :: Class 'GeomProber' has a base class 'QObject' which does not have a complete definition.
error: bsdisks :: Try compiling the source file with -fstandalone-debug.
* thread #1, name = 'bsdisks', stop reason = signal SIGSEGV
  * frame #0: 0x000000000026e544 bsdisks`std::__1::__bitset<1ul, 2ul>::all(this=0x0000000000000058) const at bitset:579:15
    frame #1: 0x000000000026c685 bsdisks`std::__1::bitset<2ul>::all(this=0x0000000000000058) const at bitset:1028:18
    frame #2: 0x0000000000265cc7 bsdisks`ObjectManager::updateBlock(this=0x00000000002950a0, dev=<unavailable>) at objectmanager.cpp:105:22
    frame #3: 0x0000000000241f83 bsdisks`QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QString>, void, void (ObjectManager::*)(QString)>::call(f=90 5c 26 00 00 00 00 00 00 00 00 00 00 00 00 00, o=0x00000000002950a0, arg=0x00000008020e3748)(QString), ObjectManager*, void**) at qobjectdefs_impl.h:152:13
    frame #4: 0x0000000000241eb3 bsdisks`void QtPrivate::FunctionPointer<void (ObjectManager::*)(QString)>::call<QtPrivate::List<QString>, void>(f=90 5c 26 00 00 00 00 00 00 00 00 00 00 00 00 00, o=0x00000000002950a0, arg=0x00000008020e3748)(QString), ObjectManager*, void**) at qobjectdefs_impl.h:185:13
    frame #5: 0x0000000000241d96 bsdisks`QtPrivate::QSlotObject<void (ObjectManager::*)(QString), QtPrivate::List<QString>, void>::impl(which=1, this_=0x00000008019a9600, r=0x00000000002950a0, a=0x00000008020e3748, ret=0x0000000000000000) at qobjectdefs_impl.h:418:17
    frame #6: 0x000000080087a0af libQt5Core.so.5`QObject::event(QEvent*) + 879
    frame #7: 0x000000080084d6bd libQt5Core.so.5`QCoreApplicationPrivate::notify_helper(QObject*, QEvent*) + 109
    frame #8: 0x000000080084d2b2 libQt5Core.so.5`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 210
    frame #9: 0x000000080084e3b9 libQt5Core.so.5`QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 761
    frame #10: 0x00000008008a9928 libQt5Core.so.5`___lldb_unnamed_symbol2589$$libQt5Core.so.5 + 24
    frame #11: 0x00000008016967d7 libglib-2.0.so.0`g_main_context_dispatch + 327
    frame #12: 0x0000000801696b9a libglib-2.0.so.0`___lldb_unnamed_symbol117$$libglib-2.0.so.0 + 538
    frame #13: 0x0000000801696c54 libglib-2.0.so.0`g_main_context_iteration + 100
    frame #14: 0x00000008008a9360 libQt5Core.so.5`QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 96
    frame #15: 0x000000080084923e libQt5Core.so.5`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 510
    frame #16: 0x000000080084d96e libQt5Core.so.5`QCoreApplication::exec() + 142
    frame #17: 0x000000000023b3ca bsdisks`main(argc=3, argv=0x00007fffffffecf8) at main.cpp:159:5
    frame #18: 0x000000000022710f bsdisks`__fini_array_end + 271
(lldb) ^d

One of the bsdisks processes is still running - I don't remember this happening before:

[0]# pstree | grep bsdisks
 |   \--- 30935 root grep bsdisks
 |--- 30250 root /usr/local/bin/bsdisks --no-debug --syslog-output
[0]# 

-- Martin
Comment 18 Martin Birgmeier 2020-08-09 15:38:59 UTC
Hmmm... I created a tar.xz containing bsdisks, the core file, and all used shared libraries, but its size is approx. 10 MB and thus too large to attach here... most of it is the core file (60 MB uncompressed, 7 MB compressed).

-- Martin
Comment 19 Gleb Popov freebsd_committer 2020-08-09 15:42:08 UTC
Exit X11, so that it doesn't start bsdisks on its own and then run steps from my previous post.

This will ensure that only one bsdisks process is running in foreground.
Comment 20 Martin Birgmeier 2020-08-09 16:02:41 UTC
O.k. I must admit I did not exit X but instead switched to a tty using <ctrl><alt>Fn.

The result is pretty much the same:
- killall bsdisks
- (in /root) bsdisks
- switch to another tty using Fn
- verify that bsdisks runs: again two processes, one is the child of the other (PID difference is always 2, not 1)
- also verify that it is the hand-started one: yes, no flags seen in pstree
- mount the stick
- verify no core dump produced yet
- unmount the stick
- bsdisks dumps core
- one of the processes continues running.

-- Martin
Comment 21 Martin Birgmeier 2020-08-09 16:11:52 UTC
bsdisks seems to use a lot of shared libraries. For this kind of functionality maybe it would be better to base it on a few base libraries only.

[0]# ldd /usr/local/bin/bsdisks
/usr/local/bin/bsdisks:
        libQt5DBus.so.5 => /usr/local/lib/qt5/libQt5DBus.so.5 (0x8002bc000)
        libQt5Core.so.5 => /usr/local/lib/qt5/libQt5Core.so.5 (0x800400000)
        libcam.so.7 => /lib/libcam.so.7 (0x800347000)
        libgeom.so.5 => /lib/libgeom.so.5 (0x80037d000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x800960000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x800386000)
        libm.so.5 => /lib/libm.so.5 (0x8003a8000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8003da000)
        libc.so.7 => /lib/libc.so.7 (0x800a30000)
        libdbus-1.so.3 => /usr/local/lib/libdbus-1.so.3 (0x800e28000)
        libthr.so.3 => /lib/libthr.so.3 (0x800e7f000)
        libkvm.so.7 => /lib/libkvm.so.7 (0x800eac000)
        libprocstat.so.1 => /usr/lib/libprocstat.so.1 (0x800ebf000)
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x8003f4000)
        libz.so.6 => /lib/libz.so.6 (0x800ecd000)
        libdouble-conversion.so.3 => /usr/local/lib/libdouble-conversion.so.3 (0x800ee7000)
        libicui18n.so.67 => /usr/local/lib/libicui18n.so.67 (0x800efd000)
        libicuuc.so.67 => /usr/local/lib/libicuuc.so.67 (0x801229000)
        libpcre2-16.so.0 => /usr/local/lib/libpcre2-16.so.0 (0x801429000)
        libzstd.so.1 => /usr/local/lib/libzstd.so.1 (0x8014d2000)
        libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x8015c7000)
        libsbuf.so.6 => /lib/libsbuf.so.6 (0x8003f9000)
        libbsdxml.so.4 => /lib/libbsdxml.so.4 (0x8016e8000)
        libelf.so.2 => /lib/libelf.so.2 (0x801715000)
        libutil.so.9 => /lib/libutil.so.9 (0x801730000)
        libicudata.so.67 => /usr/local/lib/libicudata.so.67 (0x801747000)
        libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x801749000)
        libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x801849000)
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x8018ec000)
[0]#
Comment 22 Gleb Popov freebsd_committer 2020-08-11 08:39:15 UTC
I'm unable to reproduce your issue on my side - either crash or duplicated processes, so I'll need more input from you.

(In reply to Martin Birgmeier from comment #20)

> - (in /root) bsdisks

At this stage, did bsdisks successfully start? What is printed to the console?

> - bsdisks dumps core
> - one of the processes continues running.

Any messages in the console in which bsdisks was started?

> bsdisks seems to use a lot of shared libraries. For this kind of functionality maybe it would be better to base it on a few base libraries only.

Interoperating with D-Bus requires either tons of boilerplate code or some wrapping library. bsdisks use QtDBus for that. When I was starting this project, I also didn't want to bring in heavy dependencies.
Comment 23 Martin Birgmeier 2020-08-16 12:09:52 UTC
The output below is after executing
    killall bsdisks
    bsdisks

This is now with bsdisks-0.20 built using regular portmaster, no debugging.

In this case, only one process is running is indeed bsdisks.

Here is the output, I entered two newlines before the stick was inserted and also before it was removed. The interesting point is that there was indeed no core dump, but when running it from devd there are still core dumps - but not every time.

Interesting point: when inserting the stick there are two notifications of the device being available. I assume this is because hald is also still running. hal is needed by webcamd. Maybe this leads to the core dumps?

Also, since hald still seems to be handling device inserting and removal, maybe bsdisks should still be optional for kf5-solid, with hal the alternative.

-- Martin

----------------------------------------------------------------------------------
"ada0s3"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s2"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"Registering /org/freedesktop/UDisks2/drives/ada0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
Finished GEOM probe on  "cd0"
Finished FS probe on  "cd0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
"Registering /org/freedesktop/UDisks2/block_devices/cd0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
Finished GEOM probe on  "ada0"
Finished FS probe on  "ada0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
"Registering /org/freedesktop/UDisks2/block_devices/ada0"
"Registering /org/freedesktop/UDisks2/block_devices/ada0s3"
Pop  "ada0s3"  from m_postponedRegistrations
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"Registering /org/freedesktop/UDisks2/block_devices/ada0s1"
Pop  "ada0s1"  from m_postponedRegistrations
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4"
Pop  "ada0s4"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4b"
Pop  "ada0s4b"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4e"
Pop  "ada0s4e"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4a"
Pop  "ada0s4a"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s2"
Pop  "ada0s2"  from m_postponedRegistrations


Created drive  "da0"
Created block  "da0"
Finished FS probe on  "da0"
"Registering /org/freedesktop/UDisks2/drives/da0"
Finished GEOM probe on  "da0"
"Registering /org/freedesktop/UDisks2/block_devices/da0"


"Unregistering /org/freedesktop/UDisks2/block_devices/da0"
"Unregistering /org/freedesktop/UDisks2/drives/da0"
----------------------------------------------------------------------------------
Comment 24 Gleb Popov freebsd_committer 2020-08-16 12:27:25 UTC
What version of kf5-solid do you have installed?
Comment 25 Martin Birgmeier 2020-08-16 12:31:07 UTC
kf5-solid-5.73.0

-- Martin
Comment 26 Martin Birgmeier 2020-08-16 12:39:28 UTC
I performed the wrong test - the core dump happens when unmounting the device, so it needs to be mounted, too, not just inserted and removed.

And then the core dump also happens if bsdisks is started from the command line, same as when started by devd.

Here the output, again with 2 x 2 newlines inserted by me.

-------------------------------------------------------------------
[0]# bsdisks                                                                    
Created block  "ada0s2"                                                         
Created block  "ada0s3"                                                         
Created block  "ada0s1"                                                         
Created block  "ada0s4"                                                         
Created block  "ada0s4b"                                                        
Created block  "ada0s4a"                                                        
Created block  "ada0s4e"                                                        
Created drive  "cd0"                                                            
Created block  "cd0"                                                            
Created drive  "ada0"                                                           
Created block  "ada0"                                                           
Finished GEOM probe on  "ada0s2"                                                
Finished GEOM probe on  "ada0s3"                                                
Finished FS probe on  "ada0s2"                                                  
"ada0s2"  waits for partition table  "ada0"
Finished FS probe on  "ada0s3"
"ada0s2"  waits for partition table  "ada0"   
"ada0s3"  waits for partition table  "ada0"   
Finished GEOM probe on  "ada0s1"                                                
Finished FS probe on  "ada0s1"                                                  
"ada0s2"  waits for partition table  "ada0"
"ada0s3"  waits for partition table  "ada0"
"ada0s1"  waits for partition table  "ada0"   
Finished GEOM probe on  "ada0s4"                                                
Finished FS probe on  "ada0s4"                                                  
"ada0s2"  waits for partition table  "ada0"   
"ada0s3"  waits for partition table  "ada0"                
"ada0s1"  waits for partition table  "ada0" 
"ada0s4"  waits for partition table  "ada0"   
Finished GEOM probe on  "ada0s4b"                                               
Finished GEOM probe on  "ada0s4a"                                               
Finished FS probe on  "ada0s4b"                                                 
"ada0s2"  waits for partition table  "ada0"   
"ada0s3"  waits for partition table  "ada0"   
"ada0s1"  waits for partition table  "ada0"                
"ada0s4"  waits for partition table  "ada0" 
"ada0s4b"  waits for partition table  "ada0s4"
Finished FS probe on  "ada0s4a"                                                 
"ada0s4b"  waits for partition table  "ada0s4"             
"ada0s2"  waits for partition table  "ada0" 
"ada0s3"  waits for partition table  "ada0"                 
"ada0s1"  waits for partition table  "ada0"  
"ada0s4"  waits for partition table  "ada0"                 
"ada0s4a"  waits for partition table  "ada0s4"
Finished GEOM probe on  "ada0s4e"                                               
"Registering /org/freedesktop/UDisks2/drives/cd0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
"ada0s3"  waits for partition table  "ada0"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"      
Finished FS probe on  "ada0s4e"
"ada0s4b"  waits for partition table  "ada0s4"          
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
"ada0s3"  waits for partition table  "ada0"   
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
Finished GEOM probe on  "cd0"
Finished FS probe on  "cd0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
"Registering /org/freedesktop/UDisks2/block_devices/cd0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
Finished GEOM probe on  "ada0"
Finished FS probe on  "ada0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"ada0s2"  waits for partition table  "ada0"
"Registering /org/freedesktop/UDisks2/block_devices/ada0"
"Registering /org/freedesktop/UDisks2/block_devices/ada0s3"
Pop  "ada0s3"  from m_postponedRegistrations
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
"Registering /org/freedesktop/UDisks2/block_devices/ada0s1"
Pop  "ada0s1"  from m_postponedRegistrations
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s4e"  waits for partition table  "ada0s4"
Pop  "ada0s4"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4b"
Pop  "ada0s4b"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4a"
Pop  "ada0s4a"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4e"
Pop  "ada0s4e"  from m_postponedRegistrations


Created drive  "da0"
Created block  "da0"
Finished FS probe on  "da0"
"Registering /org/freedesktop/UDisks2/drives/da0"
Finished GEOM probe on  "da0"
"Registering /org/freedesktop/UDisks2/block_devices/da0"


zsh: segmentation fault (core dumped)  bsdisks
[139]# 
-------------------------------------------------------------------
Comment 27 Martin Birgmeier 2020-08-16 12:40:31 UTC
Btw, with bsdisks-0.20 I did not yet see 2 processes running at the same time.

-- Martin
Comment 28 Martin Birgmeier 2020-08-16 12:47:28 UTC
It is also interesting to note that now the device manager icon shows the device as "most recently inserted" even when it has already been removed. Is this because it is entered twice (by hald and bsdisks) but removed only once?

-- Martin
Comment 29 Gleb Popov freebsd_committer 2020-08-16 13:04:29 UTC
(In reply to Martin Birgmeier from comment #28)
It might be possible that hald causes this disruption. To verify this, run

solid-hardware5 list and check its output for hald items.
Comment 30 Martin Birgmeier 2020-08-16 13:25:04 UTC
The first output below is without the stick being inserted, the second with. There do not seem to be hald entries.

[1]# solid-hardware5 list
QKqueueFileSystemWatcherEngine::addPaths: open: No such file or directory
udi = '/org/kde/fstab'
udi = '/org/kde/fstab/pid1752@mizar:/srcs:/srcs'
udi = '/org/kde/fstab/pid1752@mizar:/vol:/vol'
udi = '/org/kde/fstab/pid1752@mizar:/users:/users'
udi = '/org/kde/fstab/pid1752@mizar:/d/auto:/d/auto'
udi = '/org/kde/fstab///admin@mizar/martin'
udi = '/org/freedesktop/UDisks2/block_devices/ada0'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s1'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s2'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s3'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s4'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s4a'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s4b'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s4e'
udi = '/org/freedesktop/UDisks2/block_devices/cd0'
udi = '/org/freedesktop/UDisks2/drives/ada0'
udi = '/org/freedesktop/UDisks2/drives/cd0'
udi = '/org/freedesktop/UPower'
udi = '/org/freedesktop/UPower/devices/battery_devxbatteryx0'
udi = '/org/freedesktop/UPower/devices/line_power_hwxacpixacline'
[1]# solid-hardware5 list
QKqueueFileSystemWatcherEngine::addPaths: open: No such file or directory
udi = '/org/kde/fstab'
udi = '/org/kde/fstab/pid1752@mizar:/vol:/vol'
udi = '/org/kde/fstab/pid1752@mizar:/users:/users'
udi = '/org/kde/fstab/pid1752@mizar:/srcs:/srcs'
udi = '/org/kde/fstab/pid1752@mizar:/d/auto:/d/auto'
udi = '/org/kde/fstab///admin@mizar/martin'
udi = '/org/freedesktop/UDisks2/block_devices/ada0'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s1'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s2'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s3'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s4'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s4a'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s4b'
udi = '/org/freedesktop/UDisks2/block_devices/ada0s4e'
udi = '/org/freedesktop/UDisks2/block_devices/cd0'
udi = '/org/freedesktop/UDisks2/block_devices/da0'
udi = '/org/freedesktop/UDisks2/drives/ada0'
udi = '/org/freedesktop/UDisks2/drives/cd0'
udi = '/org/freedesktop/UDisks2/drives/da0'
udi = '/org/freedesktop/UPower'
udi = '/org/freedesktop/UPower/devices/battery_devxbatteryx0'
udi = '/org/freedesktop/UPower/devices/line_power_hwxacpixacline'
[1]#
Comment 31 Gleb Popov freebsd_committer 2020-08-16 14:07:38 UTC
Indeed, it seems that solid doesn't pull any information from hald.

Ok, let's get back to basic debugging. Rebuild bsdisks WITH_DEBUG=1 and repeat steps you did in #26. With debugging symbols enabled, you should see some informative message near the "segmentation fault" line. Also, add --debug-devd flag to the command line when starting bsdisks.
Comment 32 Martin Birgmeier 2020-08-16 14:18:26 UTC
o.k. here it goes... thanks for the support!

There are now 3 x 2 additional newlines - there were messages after mounting the device.

---------------------------------------------------------------------------------------
[0]# pstree | grep bsdisks
 |--- 64173 root /usr/local/bin/bsdisks --no-debug --syslog-output
 |   \--- 69633 root grep bsdisks
[0]# killall bsdisks
[0]# pstree | grep bsdisks
 |   \--- 69637 root grep bsdisks
[0]# bsdisks --debug-devd
Created block  "ada0s2"
Created block  "ada0s3"
Created block  "ada0s4"
Created block  "ada0s1"
Created block  "ada0s4e"
Created block  "ada0s4b"
Created block  "ada0s4a"
Created drive  "cd0"
Created block  "cd0"
Created drive  "ada0"
Created block  "ada0"
Finished GEOM probe on  "ada0s2"
Finished GEOM probe on  "ada0s3"
Finished FS probe on  "ada0s3"
"ada0s3"  waits for partition table  "ada0"
Finished GEOM probe on  "ada0s4"
Finished FS probe on  "ada0s4"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
Finished GEOM probe on  "ada0s1"
Finished FS probe on  "ada0s1"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s1"  waits for partition table  "ada0"
Finished GEOM probe on  "ada0s4e"
Finished FS probe on  "ada0s4e"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s1"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
Finished GEOM probe on  "ada0s4b"
Finished FS probe on  "ada0s4b"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4b"  waits for partition table  "ada0s4"
Finished GEOM probe on  "ada0s4a"
"Registering /org/freedesktop/UDisks2/drives/cd0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
Finished FS probe on  "ada0s4a"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
Finished GEOM probe on  "cd0"
devd message:  QHash(("cam_status", "\"0xcc\"")("serial", "\"\"")("cdev", "")("subsystem", "periph")("scsi_status", "2")("scsi_sense", "\"70")("CDB", "\"25")("type", "error")("device", "cd0")("!system", "CAM"))
Finished FS probe on  "cd0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"Registering /org/freedesktop/UDisks2/block_devices/cd0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"Registering /org/freedesktop/UDisks2/drives/ada0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
Finished GEOM probe on  "ada0"
Finished FS probe on  "ada0"
"ada0s3"  waits for partition table  "ada0"
"ada0s4"  waits for partition table  "ada0"
"ada0s4e"  waits for partition table  "ada0s4"
"ada0s4b"  waits for partition table  "ada0s4"
"ada0s1"  waits for partition table  "ada0"
"ada0s4a"  waits for partition table  "ada0s4"
"Registering /org/freedesktop/UDisks2/block_devices/ada0"
"Registering /org/freedesktop/UDisks2/block_devices/ada0s3"
Pop  "ada0s3"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4"
Pop  "ada0s4"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4e"
Pop  "ada0s4e"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4b"
Pop  "ada0s4b"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s1"
Pop  "ada0s1"  from m_postponedRegistrations
"Registering /org/freedesktop/UDisks2/block_devices/ada0s4a"
Pop  "ada0s4a"  from m_postponedRegistrations


devd message:  QHash(("cdev", "usb/0.8.0\n")("subsystem", "CDEV")("type", "CREATE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "ugen0.8\n")("subsystem", "CDEV")("type", "CREATE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "usb/0.8.1\n")("subsystem", "CDEV")("type", "CREATE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "usb/0.8.2\n")("subsystem", "CDEV")("type", "CREATE")("!system", "DEVFS"))
devd message:  QHash(("release", "0x0100")("cdev", "ugen0.8")("port", "4")("subsystem", "DEVICE")("mode", "host")("vendor", "0x13fe")("devclass", "0x00")("devsubclass", "0x00")("type", "ATTACH")("ugen", "ugen0.8")("!system", "USB")("product", "0x3e00")("parent", "ugen0.3\n")("sernum", "\"07BB14027B7A00FD\""))
devd message:  QHash(("interface", "0")("release", "0x0100")("cdev", "ugen0.8")("subsystem", "INTERFACE")("intclass", "0x08")("mode", "host")("vendor", "0x13fe")("devclass", "0x00")("devsubclass", "0x00")("type", "ATTACH")("intprotocol", "0x50\n")("intsubclass", "0x06")("ugen", "ugen0.8")("endpoints", "2")("!system", "USB")("product", "0x3e00")("sernum", "\"07BB14027B7A00FD\""))
devd message:  QHash(("devsubclass", "0x00")("release", "0x0100")("intclass", "0x08")("cdev", "")("devaddr", "8")("interface", "0")("bus", "0")("port", "4")("hubaddr", "3")("mode", "host")("sernum", "\"07BB14027B7A00FD\"")("devproto", "0x00")("devclass", "0x00")("vendor", "0x13fe")("intprotocol", "0x50")("product", "0x3e00")("intsubclass", "0x06")("ugen", "ugen0.8"))
devd message:  QHash(("cdev", "pass2\n")("subsystem", "CDEV")("type", "CREATE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "")("subsystem", "disk")("devname", "da0\n")("type", "GEOM::physpath")("!system", "GEOM"))
Created drive  "da0"
devd message:  QHash(("cdev", "da0\n")("subsystem", "CDEV")("type", "CREATE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "da0\n")("subsystem", "DEV")("type", "CREATE")("!system", "GEOM"))
Created block  "da0"
devd message:  QHash(("cdev", "ntfs/disk54\n")("subsystem", "CDEV")("type", "CREATE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "ntfs/disk54\n")("subsystem", "DEV")("type", "CREATE")("!system", "GEOM"))
Finished FS probe on  "da0"
devd message:  QHash(("cdev", "diskid/DISK-07BB14027B7A00FD\n")("subsystem", "CDEV")("type", "CREATE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "diskid/DISK-07BB14027B7A00FD\n")("subsystem", "DEV")("type", "CREATE")("!system", "GEOM"))
Finished GEOM probe on  "da0"
"da0"  waits for drive  "da0"
"Registering /org/freedesktop/UDisks2/drives/da0"
"Registering /org/freedesktop/UDisks2/block_devices/da0"
Pop  "da0"  from m_postponedRegistrations


devd message:  QHash(("cdev", "diskid/DISK-07BB14027B7A00FD\n")("subsystem", "CDEV")("type", "DESTROY")("!system", "DEVFS"))
devd message:  QHash(("cdev", "diskid/DISK-07BB14027B7A00FD\n")("subsystem", "DEV")("type", "DESTROY")("!system", "GEOM"))


devd message:  QHash(("cdev", "da0\n")("subsystem", "CDEV")("type", "MEDIACHANGE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "da0\n")("subsystem", "DEV")("type", "MEDIACHANGE")("!system", "GEOM"))
devd message:  QHash(("cdev", "ntfs/disk54\n")("subsystem", "CDEV")("type", "MEDIACHANGE")("!system", "DEVFS"))
devd message:  QHash(("cdev", "ntfs/disk54\n")("subsystem", "DEV")("type", "MEDIACHANGE")("!system", "GEOM"))
zsh: segmentation fault (core dumped)  bsdisks --debug-devd
[139]# 
---------------------------------------------------------------------------------------
Comment 33 Martin Birgmeier 2020-08-16 14:46:22 UTC
Out of curiosity I just checked whether bsdisks was running again, maybe triggered by devd:

[139]# pstree | grep bsdisks
 |   \--- 70999 root grep bsdisks
 \--- 69641 root bsdisks --debug-devd
[0]# 

So it seems that bsdisks forked (devd would start it with different parameters), and the fork survived whereas the process started from the shell dumped core.

-- Martin
Comment 34 Martin Birgmeier 2020-08-16 14:49:13 UTC
Also, if I do

    solid-hardware5 list

now, with two intermediate hangs it says

[130]# solid-hardware5 list
QKqueueFileSystemWatcherEngine::addPaths: open: No such file or directory
kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.NoReply" 
 "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.NoReply" 
 "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
udi = '/org/kde/fstab'
udi = '/org/kde/fstab/pid1752@mizar:/vol:/vol'
udi = '/org/kde/fstab/pid1752@mizar:/users:/users'
udi = '/org/kde/fstab/pid1752@mizar:/srcs:/srcs'
udi = '/org/kde/fstab/pid1752@mizar:/d/auto:/d/auto'
udi = '/org/kde/fstab///admin@mizar/martin'
udi = '/org/freedesktop/UPower'
udi = '/org/freedesktop/UPower/devices/battery_devxbatteryx0'
udi = '/org/freedesktop/UPower/devices/line_power_hwxacpixacline'
[1]#
Comment 35 Gleb Popov freebsd_committer 2020-08-16 14:53:05 UTC
All right, send me a core file generated by bsdisks executable built with debugging info enabled.
Comment 36 Gleb Popov freebsd_committer 2020-08-16 15:18:49 UTC
Okay, I do see some strangeness. In your log in comment #32 there are lines

devd message:  QHash(("cdev", "diskid/DISK-07BB14027B7A00FD\n")("subsystem", "CDEV")("type", "DESTROY")("!system", "DEVFS"))
devd message:  QHash(("cdev", "diskid/DISK-07BB14027B7A00FD\n")("subsystem", "DEV")("type", "DESTROY")("!system", "GEOM"))

When do they appear? Once you unmount the USB stick?
Comment 37 Martin Birgmeier 2020-08-16 15:35:49 UTC
The group after the first two empty lines appears when plugging in the stick.

The group after the second two when mounting the stick.

The group after the third when unmounting, followed by the core dump.

The 07BB14027B7A00FD itself is just the serial number of the stick, it gets converted to a /dev/diskid/DISK-07BB14027B7A00FD by the geom framework (I assume by geom_label).

-- Martin
Comment 38 Martin Birgmeier 2020-08-16 15:38:32 UTC
So, to answer your question directly, when mounting the stick.

I guess it happens because this is mounted (fstab):

/dev/ntfs/disk54   /d/54   ntfs    rw,noauto,mountprog=/usr/local/bin/ntfs-3g   0 0

And then the corresponding /dev/diskid is removed by the kernel.

-- Martin
Comment 39 Gleb Popov freebsd_committer 2020-08-16 18:49:50 UTC
Can you, please, put this file into ${PORTSDIR}/sysutils/bsdisks/files directory and rebuild the port? I'm hoping this should make the crash go away.
Comment 40 Gleb Popov freebsd_committer 2020-08-16 18:49:59 UTC
Can you, please, put this file into ${PORTSDIR}/sysutils/bsdisks/files directory and rebuild the port? I'm hoping this should make the crash go away.
Comment 41 Gleb Popov freebsd_committer 2020-08-16 18:50:59 UTC
Err, forgot to add the link: https://arrowd.name/patch-objectmanager.cpp
Comment 42 Martin Birgmeier 2020-08-17 17:06:41 UTC
Success!

The core dumps are gone.

Thank you for your patience!

Best regards, Martin
Comment 43 Gleb Popov freebsd_committer 2020-08-17 20:54:38 UTC
Good to know. Would you mind testing the version built from source [1]? It contains slightly different change that should also fix your issue.

[1]: https://foss.heptapod.net/bsdutils/bsdisks/-/archive/branch/default/bsdisks-branch-default.zip
Comment 44 Martin Birgmeier 2020-08-18 16:08:36 UTC
Hi Gleb,

I did not directly use your source file but rather created appropriate patches for use with portmaster; this is basically your commit https://foss.heptapod.net/bsdutils/bsdisks/-/commit/97a82aae2965d299478befc1a7ea5b1a8c9327de:

[0]# cat files/patch-devdthread.cpp files/patch-objectmanager.cpp 
diff -u bsdisks-44d99f690986b0cb222054996c3f5963c86a63ae-44d99f690986b0cb222054996c3f5963c86a63ae/devdthread.cpp bsdisks-branch-default/devdthread.cpp
--- devdthread.cpp      2020-08-13 07:21:52.000000000 +0200
+++ devdthread.cpp      2020-08-17 22:52:22.000000000 +0200
@@ -56,6 +56,10 @@
 
     QString devArg = data["cdev"].trimmed();
 
+    // don't do anything with stuff like diskid/blabla
+    if (devArg.contains('/'))
+        return;
+
     if (QCoreApplication::arguments().contains("--debug-devd"))
         qDebug() << "devd message: " << data;
 
diff -u bsdisks-44d99f690986b0cb222054996c3f5963c86a63ae-44d99f690986b0cb222054996c3f5963c86a63ae/objectmanager.cpp bsdisks-branch-default/objectmanager.cpp
--- objectmanager.cpp   2020-08-13 07:21:52.000000000 +0200
+++ objectmanager.cpp   2020-08-17 22:52:22.000000000 +0200
@@ -81,10 +81,6 @@
             return;
     }
 
-    // don't do anything with stuff like diskid/blabla
-    if(dev.contains('/'))
-        return;
-
     Q_ASSERT(!m_blockObjects.contains(dev));
 
     qDebug() << "Created block " << dev;
@@ -120,10 +116,6 @@
         if(drive->vendor() == "VBOX CD-ROM")
             return;
     }
-
-    // don't do anything with stuff like diskid/blabla
-    if(dev.contains('/'))
-        return;
 
     // happens with partitions blocks - we delete them along with table block,
     // but the devd event may arrive after that
[0]# 

Result: This also is working. :-)

-- Martin
Comment 45 commit-hook freebsd_committer 2020-08-19 06:59:46 UTC
A commit references this bug:

Author: arrowd
Date: Wed Aug 19 06:59:29 UTC 2020
New revision: 545274
URL: https://svnweb.freebsd.org/changeset/ports/545274

Log:
  sysutils/bsdisks: Update to 0.21. Stability fixes.

  PR:		248531

Changes:
  head/sysutils/bsdisks/Makefile
  head/sysutils/bsdisks/distinfo
Comment 46 Gleb Popov freebsd_committer 2020-08-19 07:00:40 UTC
(In reply to Martin Birgmeier from comment #44)

Thank you for helping with debugging and testing the fix.
Comment 47 Martin Birgmeier 2020-08-19 15:52:46 UTC
Hi Gleb,

Thanks to you for the fix and especially for the good collaboration!

Best regards,

Martin