Min Resolution: Floating Point Exception
Closed this issue · 8 comments
Hi,
I get the following error.
$ ./btdu --headless --min-resolution=1G --du /mnt/sda2
[1] 1073680 floating point exception ./btdu --headless --min-resolution=1G --du /mnt/sda2
I have mounted my top-level btfs subvolume as follows.
$ mkdir /mnt/sda2
$ mount -o subvol=/ /dev/sda2 /mnt/sda2
Below is a list of commands that work and those that do not.
# works
./btdu /mnt/sda2
./btdu --headless --max-time=10s --du /mnt/sda2
# works not
./btdu --headless --min-resolution=1G --du /mnt/sda2
./btdu --headless --min-resolution=1000 --du /mnt/sda2
./btdu --headless --max-time=10s --min-resolution=1000 --du /mnt/sda2
So I think it has something to do with the --min-resolution
option.
Could this be a bug or am I doing something wrong?
I use version v0.5.0.
$ ./btdu --help
btdu v0.5.0
(..)
Best,
Markus
I've been chasing this bug for a while: c85d7f0
Can you reproduce it reliably? I managed to reproduce it once and then it stops happening (until I reboot I assume).
If so, would you mind running a debug build in a debugger and getting a stack trace of where the FPE happens?
Thanks for your fast response, yes we can reproduce it, but unfortunately i am not able to build a debug version, could you get me started?
i tried with your ci/build-docker.sh
script and different build flags in ci/build-inside-docker.sh
. And also with my own docker container with different dub build
commands and it was always built but did not produce a stacktrace and regarding to gdb
was missing the debug symbols, so it seems i miss something.
Have you tried the method described in the README? In this case, simply omit -b release
.
To build a binary the same way the CI does it, replace the -flto=full
, -O
, and --release
flags with -g
.
To be sure i built it now directly on the machine, but its the same, it simple prints no stacktrace when i run the following command, but if i run it not with the top-level btrfs subvolume, it generates a stacktrace...
# no stack trace
$ ./btdu --headless --min-resolution=1G --du /tmp/btdu
[1] 3799 floating point exception ./btdu --headless --min-resolution=1G --du /tmp/btdu
So i ran it directly with gdb like this, i hope this helps.
$ gdb --silent --args ./btdu --headless --min-resolution=1G --du /tmp/btdu
Reading symbols from ./btdu...
(gdb) run
Starting program: /root/btdu/btdu --headless --min-resolution=1G --du /tmp/btdu
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 3973]
Program received signal SIGFPE, Arithmetic exception.
0x0000555555b3a5e6 in btdu.main.program(ae.utils.funopt._OptionImpl!(2, immutable(char)[], "Path to the root of the filesystem to analyze", '\x00', null, null)._OptionImpl, ae.utils.funopt._OptionImpl!(1, uint, "Number of sampling subprocesses\n (default is number of logical CPUs for this system)", 'j', "N", null)._OptionImpl, ae.utils.funopt._OptionImpl!(1, uint, "Random seed used to choose samples", '\x00', null, null)._OptionImpl, ae.utils.funopt._OptionImpl!(0, bool, "hiddenOption", '\x00', null, null)._OptionImpl, ae.utils.funopt._OptionImpl!(0, bool, "Measure physical space (instead of logical).", 'p', null, null)._OptionImpl, ae.utils.funopt._OptionImpl!(0, bool, "Expert mode: collect and show additional metrics.\nUses more memory.", 'x', null, null)._OptionImpl, ae.utils.funopt._OptionImpl!(0, bool, "hiddenOption", '\x00', null, null)._OptionImpl, ae.utils.funopt._OptionImpl!(0, bool, "Run without launching the result browser UI.", '\x00', null, null)._OptionImpl, ae.utils.funopt._OptionImpl!(1, ulong, "Stop after collecting N samples.", 'n', "N", null)._OptionImpl, ae.utils.funopt._OptionImpl!(1, immutable(char)[], "Stop after running for this duration.", '\x00', "DURATION", null)._OptionImpl, ae.utils.funopt._OptionImpl!(1, immutable(char)[], "Stop after achieving this resolution.", '\x00', "SIZE", null)._OptionImpl, ae.utils.funopt._OptionImpl!(1, immutable(char)[], "On exit, export the collected results to the given file.", 'o', "PATH", "export")._OptionImpl, ae.utils.funopt._OptionImpl!(0, bool, "On exit, export represented size estimates in 'du' format to standard output.", '\x00', null, null)._OptionImpl, ae.utils.funopt._OptionImpl!(0, bool, "Instead of analyzing a btrfs filesystem, read previously collected results saved with --export from PATH.", 'f', null, "import")._OptionImpl) (doImport=..., du=..., exportPath=..., minResolution=..., maxTime=..., maxSamples=...,
headless=..., man=..., expert=..., physical=..., subprocess=..., seed=..., procs=..., path=...) at source/btdu/main.d:233
233 (minResolution && (totalSize / browserRoot.data[SampleType.represented].samples) <= parsedMinResolution))
To be sure i built it now directly on the machine, but its the same, it simple prints no stacktrace when i run the following command, but if i run it not with the top-level btrfs subvolume, it generates a stacktrace...
Yeah, the D runtime does not print a stack trace on a signal. Only a debugger can be used for that.
So i ran it directly with gdb like this, i hope this helps.
It does, thank you! There you can type where
to get a backtrace but I can see the bug from that output too.
Well, this might not be the bug I was chasing (I might have fixed that one), but the problem is obvious for this case. I pushed a fix to master. Thanks!
First of all, it works, thank you for your awesome and fast help!
Yeah, the D runtime does not print a stack trace on a signal. Only a debugger can be used for that.
Oh, i wasn't aware of that.
It does, thank you! There you can type where to get a backtrace but I can see the bug from that output too.
Thanks i did not knew that one, i played with bt
, which seems to be the same and tried to "debugg" with printing some variables in your if statement, but only got a result for the minResolution
. Next time i am aware to attach the bt/where
output also.
This issue can be closed from our side.
Thanks for your application and great help!
We couldn't find any paypal, amazon gift or similar links, if you could provide us with something like that we would be happy to give you a small tip for your great work and support.
Thank you for the kind offer. Currently I don't accept donations, though if you'd like, you could make a pledge on my Patreon account should that change in the future. I'm glad I got it working for you!