Skip to content
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

Crashing when USB devices removed #35

Closed
drowe67 opened this issue Nov 23, 2019 · 11 comments
Closed

Crashing when USB devices removed #35

drowe67 opened this issue Nov 23, 2019 · 11 comments

Comments

@drowe67
Copy link
Owner

drowe67 commented Nov 23, 2019

Configure FreeDV with a radio and headset (two card configuration):

  1. With all USB devices connected click on Start and FreeDV runs OK
  2. Press Stop and remove one USB device
  3. Click on Start and all sorts or error messages pop up and it crashes.

I've taken an initial look at the startRxStream. This is complex code and could use some refactoring. Backing out of any failed function calls is tricky, so many structures to delete/pull down.. To deal specifically with this bug, suggest a sanity check at the top to check the available PortAudio devices and confirm they are as expected, and bail early before everything is allocated.

This is a fairly important issue, as we would like to avoid any circumstances where FreeDV can crash. Messing with USB devices is common, so it would be good to trap this.

@drowe67
Copy link
Owner Author

drowe67 commented Jan 6, 2021

@tmiw I can't seem to reproduce this issue on Ubuntu any more (756534e). Can you please try to reproduce it?

I wonder if some of your recent fixes have fixed it?

@tmiw
Copy link
Collaborator

tmiw commented Jan 7, 2021

@drowe67, in VMware at least, following the test steps on Ubuntu 20.04 LTS results in "Sound Card 1 Open/Setup Error" and no other messages/crashes, so this issue is likely fixed. (It's definitely fixed in #82, or at least the error messages are improved anyway.)

Also, I don't remember seeing crashes on Mac surrounding sound devices going away in a while, FWIW.

@drowe67
Copy link
Owner Author

drowe67 commented Jan 7, 2021

Thanks @tmiw - could you pls try it on your Windows VM? (I don't have a Windows machine or VM handy). I might also ask the list just to double check.

@tmiw
Copy link
Collaborator

tmiw commented Jan 8, 2021

@drowe67, is the Docker script working for you? It looks like I'm getting "bad tar archive" errors now while building LPCnet:

ESC[36mfdv_win_fed31_c     |ESC[0m CMake Error: Problem with archive_read_next_header(): Damaged tar archive
ESC[36mfdv_win_fed31_c     |ESC[0m CMake Error: Problem extracting tar: /home/build/freedv-gui/LPCNet/build_win64/_deps/lpcnet-subbuild/lpcnet-populate-prefix/src/lpcnet_191005_v1.0.tgz

EDIT: interesting:

-rw-rw-r-- david/david 46802739 2019-10-05 03:56 nnet_data.c

gzip: stdin: invalid compressed data--crc error

gzip: stdin: invalid compressed data--length error
tar: Skipping to next header
tar: A lone zero block at 91419
tar: Child returned status 1
tar: Error is not recoverable: exiting now
root@ubuntu:/var/lib/docker/volumes/docker_win_fed31_v/_data/freedv-gui/LPCNet/build_win64/_deps/lpcnet-subbuild/lpcnet-populate-prefix/src#

and

mooneer@ubuntu:~/freedv-gui/docker$ wget http://rowetel.com/downloads/deep/lpcnet_191005_v1.0.tgz
--2021-01-07 19:17:17--  http://rowetel.com/downloads/deep/lpcnet_191005_v1.0.tgz
Resolving rowetel.com (rowetel.com)... 103.27.34.24
Connecting to rowetel.com (rowetel.com)|103.27.34.24|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.rowetel.com/downloads/deep/lpcnet_191005_v1.0.tgz [following]
--2021-01-07 19:17:17--  http://www.rowetel.com/downloads/deep/lpcnet_191005_v1.0.tgz
Resolving www.rowetel.com (www.rowetel.com)... 103.27.34.24
Reusing existing connection to rowetel.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 18396516 (18M) [application/x-gzip]
Saving to: ‘lpcnet_191005_v1.0.tgz’

lpcnet_191005_v1.0. 100%[===================>]  17.54M  7.38MB/s    in 2.4s    

2021-01-07 19:17:20 (7.38 MB/s) - ‘lpcnet_191005_v1.0.tgz’ saved [18396516/18396516]

mooneer@ubuntu:~/freedv-gui/docker$ tar tvf lpcnet_191005_v1.0.tgz 
-rw-rw-r-- david/david 46802739 2019-10-05 03:56 nnet_data.c
tar: Skipping to next header

gzip: stdin: invalid compressed data--crc error

gzip: stdin: invalid compressed data--length error
tar: Child returned status 1
tar: Error is not recoverable: exiting now
mooneer@ubuntu:~/freedv-gui/docker$

Maybe random network/server issue?

@drowe67
Copy link
Owner Author

drowe67 commented Jan 8, 2021

Docker build worked fine for me. Maybe try:

tar xvf lpcnet_191005_v1.0.tgz

@tmiw
Copy link
Collaborator

tmiw commented Jan 8, 2021

@drowe67, I edited my last post, actually. Even downloading the file by hand outside of Docker seemed to have issues.

Weirdly, it seemed to decompress with no issue on macOS, so I'm not sure what's going on.

@tmiw
Copy link
Collaborator

tmiw commented Jan 8, 2021

@drowe67, okay, I came back to it after a few hours and the Docker build magically started working again. o_O

Anyway, on Windows, I don't get any errors. It just seems to automatically choose the default sound device (Microsoft Sound Mapper?) instead. (I selected the USB sound card as the "radio" device and the built-in sound card as the "speaker/headset" one and unplugged the USB one after pushing Stop.) The audio-ux branch should hopefully make the behavior more consistent across platforms, I think.

@tmiw
Copy link
Collaborator

tmiw commented Jan 8, 2021

That all said, it looks like I do get a "sound card open/setup error" after closing and restarting FreeDV, so the behavior is at least consistent after then. Fortunately, no crashes either way.

@drowe67
Copy link
Owner Author

drowe67 commented Jan 8, 2021

Thanks @tmiw that's great. Lets see if anyone responds on the digital voice list in the next day or so, otherwise I will close this issue.

Yes I'm looking fwd to merging and releasing #82 🙂

@tmiw
Copy link
Collaborator

tmiw commented Jan 8, 2021

@drowe67, BTW, I put the Windows build I used up here. I'll email it out to Sigfried since the squelch fix seems to have gotten merged to master prior to me generating it tonight.

@drowe67
Copy link
Owner Author

drowe67 commented Jan 8, 2021

No reports of this issue from the digital voice mailing list, and the developers can't reproduce, so closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants