-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt to Use Library Crashes with GLIBC Error #349
Comments
This could happen if Perhaps you could try building OpenWebRX+ and libnrsc5 using ASAN ( |
Are there any known issues with creating multiple instances of the NRSC5 Python class? That might be one of the causes for multiple closes. |
I have not tried creating multiple instances before. It's possible there could be bugs which come up only in that scenario. If you are able to make a script that reproduces the issue, or learn more about the crash, please let me know. |
Right now, I seem to hit the issue on every call to NRSC5 object. So, open_pipe() crashes things, and start() crashes things as well, even with everything else commented out. I do seem to have only one instance at the moment, so it might not be a multiple instance issue. Trying ASAN. |
Ok, so ASAN did not help, still cannot get a hold of the crash. It does happen with 100% repeatability though, as long as you install and run OpenWebRX+. Is it something you would be willing to do in order to catch the cause? An amd64 PC with Ubuntu Jammy or Debian Bullseye and an RTLSDR dongle will be required. |
Multiple trial-and-error experiments have pointed to this code as causing the crash:
As soon as at least one st-> assignment is made here, things crash afterwards (even if the rest of the initialization is commented out). The interesting part is that the sync_t variable is the last one in the input_t structure. |
Found and fixed the issue. Apparently, open_pipe() (and likely some other NRSC5 calls) cannot be called from a Python thread. No idea why. |
Let's keep this issue open until the root cause is understood. It's possible there's an issue in nrsc5 that needs to be fixed so that it can be used with in a Python thread. |
As Python 9 and 11 were both updated in Homebrew on my Mac today, I'm reminded that this might be a Python version issue. Unsure what version is being used to access the nrsc5 API, but there were lots of changes in v12 that broke quite a number of things. May want to try down-versioning in Ubuntu to see if the same problems exist. |
Well, one possible reason, as pointed by @jketterl, would be the unfortunate fact that fftw3 is not thread-safe and OWRX obviously uses fftw3 a lot. The simplest workaround is to avoid creating fftw3 plans in threads, so at least NRSC5 open() should happen in the main thread. The disturbing thing is that when I commented out fftw3 plan initialization from NRSC5, that alone did not eliminate the crash. Then there is the nature of the crash. From the look of things, it somehow corrupts the malloc() heap, so the next free() call trips the safety checks. |
Yeah, this isn't an easy issue to fix. It is possible to call |
It is, in theory, possible, but will lead to performance degradation. The current change (calling open() from Python object constructor) seems to do the job though. |
Yeah, if |
I did a quick Google search. It seems that is a great idea and seems there wouldn't be any problems with that. Note to use Maybe a good idea to make the global initialization an optional thing? |
When trying to use nrsc5 library from OpenWebRX+ on the amd64/x64 architecture, things immediately crash with the following message:
double free or corruption (!prev)
Both arm64 and armhf architectures are ok. Also, command-line nrsc5 utility appears to be ok.
I have been trying to debug the issue but failed: the process gets killed before GDB has a chance to look at it. Tried MALLOC_CHECK_=2, did not help.
The text was updated successfully, but these errors were encountered: