-
Notifications
You must be signed in to change notification settings - Fork 31
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
Access Violation in SoapyRTLSDR on Windows 11 (PothosSDR installation) for Consecutive Runs #76
Comments
This smells like a double-free. For a quick fix note that |
I tried the following:
This fails the same way. I also tried this:
Interestingly, this does not crash but just hangs. The python kernel stops responding. (CTRL+C does not work etc.) |
I guess the first example might keep the There are no clues why the |
I can't reproduce this in Linux, seems to be particular to Windows or your setup. |
I do not have WSL but VSCode has an extension for it so I will try to reproduce this in WSL. I never used this library in C but I can also try this with C while I am at it. |
Attached is the C code I ran in WSL (Debian). I do not run and capture samples repeatedly but just once.
When this code runs, I get the following error:
I also run using
Despite these errors, Would you mind testing the previous Python code I posted in a Windows environment to see if the issue is reproducible? This might help narrow down if it's environment-specific. |
What you are seeing there is different. Fix it in line 61 with
Note that |
Thanks for that. I fixed the code as you suggested and it works now. Then I made it so that it is in a while loop and repeatedly runs and captures data. In this case, I observed no errors, so it runs without issue in C as opposed to Python. Interestingly, while doing so, I realized the
Similarly, I then changed the python code I proposed in the first place:
The code above runs without any issues which is great. However, then the next question is that why the |
Just for completeness, I also tried to close the stream every time after I got some samples. Below is the code for that where I initialize the stream, read data and close everything again and again:
There are no issues for this code in WSL (Debian) in Win11. But the initial Python code I proposed fails for some reason (in Win11). |
There are no guarantees that The open /activate /deactivate /close sequence is needed to set up /clean up (hardware) resources. Depending on the SDR device they will perform different things and might not strictly be needed. I'd only close /reopen a device if I want to free the hardware, e.g. when the program keeps running but is done with the SDR. I'd use de/activate every time I pause the stream, i.e. when I don't want samples to be contiguous. |
Ok, we now have narrowed the bug down to Python on Windows doing something unexpected with memory locations. |
I'm encountering a
Windows fatal exception: access violation error
when using SoapyRTLSDR on Windows 11 Home 64-bit. The crash occurs when trying to interact with the RTL-SDR device (NooElec R820T2 SDR & DVB-T) using SoapySDR, and it seems to be a bug in the SoapyRTLSDR implementation on Windows.The crash happens silently, but after adding the Python
faulthandler
library, I was able to trace the exact point of failure.Environment:
SoapySDRUtil output:
The following python script can be used to reproduce the error:
Expected behaviour: The program should run without crashing, and the SDR device should be properly deactivated and closed at each iteration.
Actual behaviour: The program crashes with a "Windows fatal exception: access violation error" in the
SoapySDR.py
library when closing the stream and cleaning up the SDR device. Here is the error traceback captured usingfaulthandler
:Additional Information:
Possible Cause:
unmake
.Please let me know if you need further information, and I can provide more details.
The text was updated successfully, but these errors were encountered: