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

libhackrf hangs if HackRF is disconnected #1068

Closed
martinling opened this issue Mar 18, 2022 · 0 comments · Fixed by #1069
Closed

libhackrf hangs if HackRF is disconnected #1068

martinling opened this issue Mar 18, 2022 · 0 comments · Fixed by #1069
Assignees
Labels
Milestone

Comments

@martinling
Copy link
Member

Steps to reproduce

  1. Start hackrf_transfer -r /dev/null
  2. Unplug HackRF

Expected behaviour

Program exits with an appropriate error.

Actual behaviour

Program hangs, and can only be killed with SIGKILL.

Background

I decided to test this after writing this comment, because disconnection was the obvious case for when we would need to handle errors from libusb.

It looks like I broke this in #1029.

Running with gdb shows that the hang happens when hackrf_stop_rx() calls cancel_transfers(), which calls pthread_cond_wait to wait for cancellations to complete. But the transfer thread is already dead, because hackrf_libusb_transfer_callback saw an error and called request_exit. So the condition is never set.

We need to rethink the error handling path to work with the other changes. I'll work on that.

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

Successfully merging a pull request may close this issue.

1 participant