Skip to content

Segfault on Release audio connection (port/linux-port) #685

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

Open
simo-scar-cob opened this issue May 5, 2025 · 6 comments
Open

Segfault on Release audio connection (port/linux-port) #685

simo-scar-cob opened this issue May 5, 2025 · 6 comments

Comments

@simo-scar-cob
Copy link

Describe the bug

Using linux-port, when running/debugging the hfp_ag_demo file, a segfault happens when the audio connection is established, and I try to close it, both with stdin process input command or CTRL+C.

Image

To Reproduce

Steps to reproduce the behavior:

  1. Run example hfp_ag_demo using linux-port
  2. Connect to the headset
  3. Establish ACL connection
  4. Establish audio connection
  5. Close it: default is 'B', or close the program with CTRL+C

Expected behavior

Audio connection should close without any errors

Additional context
Running on linux embedded custom platform

@mringwal
Copy link
Member

mringwal commented May 5, 2025

Do you have a backtrace for this? A packet log might be helpful, too.
Does the same happen with modplayer demo on exit (it's playing music)?

@simo-scar-cob
Copy link
Author

At the moment, I can't get a proper backtrace.
I have a packet log here.
hci_dump_hfp_ag_demo.zip

No, it doesn't happen on modplayer (a2dp source demo tested)

@mringwal
Copy link
Member

mringwal commented May 5, 2025

Tricky. I'm currently don't have a laptop with a Linux vm, which would allow me to reproduce this. I'll get a new laptop in 1-2 weeks on which I'll setup a new Ubuntu VM. I hope this is not urgent and can wait a bit.

Until then: could you send me a packet log for the case where you just disable SCO audio with 'B'?
The segfault is irritating as the only active data source is the one to the kernel HCI socket, which should never get invalid.

@simo-scar-cob
Copy link
Author

hci_dump_hfp_ag_demo.zip

Of course, in this log dump, I disabled SCO audio with 'B'.
Also, I noticed that after some retries of the code execution (and a segfault triggered), some files related to ALSA get corrupted (atm, I don't have any trace, simply because I don't want to break my system... if it happens, I'll post it here for sure), and opening the SCO audio connection is no longer possible. The only solution I found to solve the issue is to reset the filesystem entirely, which, of course, is not good.
Hope this helps!

@mringwal
Copy link
Member

mringwal commented May 6, 2025

What do you mean by "files ... get corrupted"? BTstack has code to write: the packet log, persistent storage (by default into /tmp) and in this demo, a .wav file (into the current directory)

Thanks for the log. Nothing strange in there, just an SCO disconnect. I have currently no idea what's going on the there. I'm optimistic that this is easy to debug & fix with a debugger and hope that I can replicate it in a regular Ubuntu VM when I get the new laptop.

@simo-scar-cob
Copy link
Author

I know that BTstack has code to write those files and nothing else. I'm just wondering if there's some unexpected behaviour, caused by the segfault, that causes the corruption of something on the fs. Anyway, let's just focus on the segfault. If I can replicate the issue or encounter any other problem, I'll let you know for sure.
Yes, I also think that should be easy to solve :)

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