SOTAmat / SOTAcat

CAT control for Elecraft KX radios and SOTAMAT
https://sotamat.com
Other
9 stars 2 forks source link

BUG: SOTAMAT control of SOTACAT band and frequency changes hangs with long timeout #3

Closed brianmathews closed 4 months ago

brianmathews commented 4 months ago

If you launch SOTAMAT in SOTACAT mode, you can use the SOTAMAT band/mode selector and the frequency selector to change the band/mode/frequency on the KX radio. Most of the time this works, but frequently making a new selection in SOTAMAT will not update the frequency on the radio, and all subsequent changes will be blocked at the radio. After about 1 minute of hanging the entire sequence of commands that had been buffered during the hang will all play out onto the KX radio.

I do not know the cause of the issue: is the hang on the SOTAMAT side or the SOTACAT side? Instrumenting with debugging console logs could help on the SOTACAT side to see when REST API calls are made and when radio commands are issued.

brianmathews commented 4 months ago

I added debugging console logging code to both SOTAMAT and SOTACAT.

What I see:

Even though this narrows the issue down considerably to just one line of code, I don't understand why it isn't working. Yes, I understand the threading concerns, but that doesn't seem to be the issue as far as I can tell at the moment. If I change the Xamarin HTTP timeout to just 2 seconds, I catch the timeout error but things are still in an odd state.

jeffkowalski commented 4 months ago

I can't reproduce this here, and might not be able to effectively debug it. On android, there's no "spinner". One has to select the freq, then that triggers the call to the cat and subsequently the radio. So there's no request flood while scrolling through the frequencies. I suppose the iOS UI is different. I tried a serial flood of curl requests to the frequency PUT api, but there was no error. It worked fine. Can anyone create a shell script that calls curl against the web api to reproduce this lockup? Or, short of that, link to a log of requests leading up to the error?

brianmathews commented 4 months ago

I might have to take this one. The issue might not be on the SOTACAT side. It could be a weird Xamarin on iOS HTTP issue, and it wouldn't be the first time. I know I have a bug in my Xamarin code where I don't recycle HTTP objects correctly and this might cause a timing / lockup issue.

jeffkowalski commented 4 months ago

potentially fixed by 95a7a67445a3382fc33df51448cfe5c41664bf32 needs more testing

brianmathews commented 4 months ago

I could not reproduce. I'm calling this fixed and closing. Nice work!