PhantomSDR Support Forum

General Category => PhantomSDR Bugs => Topic started by: Bas ON5HB on Sep 09, 2024, 09:29 PM

Title: 1.5.4 crashes....
Post by: Bas ON5HB on Sep 09, 2024, 09:29 PM
Just had a crash, did happen a few times before.

traps: spectrumserver[141947] general protection fault ip:55880a042f60 sp:7f0655cba6c0 error:0 in spectrumserver[558809f7e000+db000]

I found that error:0 implies a devide by zero in the code.
Title: Re: 1.5.4 crashes....
Post by: Bas ON5HB on Sep 09, 2024, 10:36 PM
I have looked in the code you changed....and I found this....can this be the problem?

float peak_sample = max();

            float desired_gain = std::min(desired_level / (peak_sample + 1e-15f), max_gain);

Not sure, but if the (peak_sample + 1e-15f) part becomes 0 it could happen.

No idea if it helps. Found it in utils/audioprocessing.cpp
Title: Re: 1.5.4 crashes....
Post by: magicint1337 on Sep 10, 2024, 07:06 AM
The + 1e-15f is only there to make it never divide through zero :)
Title: Re: 1.5.4 crashes....
Post by: Bas ON5HB on Sep 10, 2024, 03:07 PM
Why not check if peaksample is 0? If so make it the value 1e-15f.

Then it can never be 0. The way you do it now can cause 0 because of rounding.

Small chance it does, but I do believe it happens from time to time and causing the spectrumserver to crash.

You're way it can become 0 when peak_sample is -1e-15f, counted together they become 0.

Just a thought, I normally don't program with floating because of these problems.
Title: Re: 1.5.4 crashes....
Post by: magicint1337 on Sep 10, 2024, 04:16 PM
Very rare edge case, may happen but you cant just dont code with floating point because of that. Especially not in DSP

In future version will be changed.
Title: Re: 1.5.4 crashes....
Post by: Bas ON5HB on Sep 10, 2024, 05:38 PM
I code in drivers, like the Airspy_tcp or the RSP_tcp, they do not need floating to output 8bit ;)
Title: Re: 1.5.4 crashes....
Post by: Bas ON5HB on Sep 10, 2024, 05:41 PM
That didn't take long, it crashed again, took less then 10 minutes:

[30847.925132] traps: spectrumserver[141947] general protection fault ip:55880a042f60 sp:7f0655cba6c0 error:0 in spectrumserver[558809f7e000+db000]

Location is the same....so it must be happening elsewhere....
Title: Re: 1.5.4 crashes....
Post by: Bas ON5HB on Sep 10, 2024, 05:45 PM
And again....it's happening faster now...every few minutes...

That is good...
Title: Re: 1.5.4 crashes....
Post by: Bas ON5HB on Sep 10, 2024, 06:01 PM
I have noticed that when it happens the RX888 is having messages in dmesg...

It may not be related but the USB ports where on auto-powersafe (=default!)...so I turned them ON all the time in my start-script.

# Turn USB on all the time.
echo on | sudo tee /sys/bus/usb/devices/*/power/control > /dev/null