Skip to content

WIP: Try handling device removal#4

Closed
strohel wants to merge 3 commits intomainfrom
try-handling-device-removal
Closed

WIP: Try handling device removal#4
strohel wants to merge 3 commits intomainfrom
try-handling-device-removal

Conversation

@strohel
Copy link
Copy Markdown
Member

@strohel strohel commented Oct 21, 2025

@strohel
Copy link
Copy Markdown
Member Author

strohel commented Oct 21, 2025

This produces the following logs on disconnect:

[2025-10-21T22:09:14Z INFO ] strohel io_changed: 113, 7, 0x7fc2cbdc3230, 1688
[2025-10-21T22:09:14Z INFO ] strohel io_changed: 90, 7, 0x7fc20c360230, 1688
[2025-10-21T22:09:14Z INFO ] strohel state_changed: 113, Streaming, Paused
[2025-10-21T22:09:14Z INFO ] strohel state_changed: 90, Streaming, Paused
[2025-10-21T22:09:14Z INFO ] strohel param_changed: 90, 15, pod omitted
[2025-10-21T22:09:14Z INFO ] strohel param_changed: 113, 15, pod omitted
[2025-10-21T22:09:19Z WARN ] Audio playback callback has not been called longer than 5s. This likely indicates that we lost connection to the audio device. The failure may be transient. Trying to restart the playback stream.
[2025-10-21T22:09:19Z INFO ] Ejecting stream
[2025-10-21T22:09:19Z WARN ] Callback for audio stream tonari capture has not been called longer than 5s. This likely indicates that we lost connection to the audio device. The failure may be transient. Trying to restart the capture stream.
[2025-10-21T22:09:19Z INFO ] Ejecting stream

And then hangs. The reason for the hang is simple: The tx with the eject command is only read from the process() event listener, and it is not called when the stream is stopped. :)

@strohel
Copy link
Copy Markdown
Member Author

strohel commented Oct 21, 2025

There are many ways in which the event loop can be kicked from the outside. Easy one is a timer (just pushed), which indeed continues working even if the stream stops:

[2025-10-21T22:40:08Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:08Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:09Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:09Z INFO ] strohel timer fired, n: 1)

# device disconnected
[2025-10-21T22:40:10Z INFO ] strohel io_changed: 100, 7, 0x7fd5cc0aa230, 1688
[2025-10-21T22:40:10Z INFO ] strohel io_changed: 105, 7, 0x7fd5c7fe0230, 1688
[2025-10-21T22:40:10Z INFO ] strohel state_changed: 100, Streaming, Paused
[2025-10-21T22:40:10Z INFO ] strohel state_changed: 105, Streaming, Paused
[2025-10-21T22:40:10Z INFO ] strohel param_changed: 105, 15, pod omitted
[2025-10-21T22:40:10Z INFO ] strohel param_changed: 100, 15, pod omitted
[2025-10-21T22:40:10Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:10Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:11Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:11Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:12Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:12Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:13Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:13Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:14Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:14Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:15Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:15Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:16Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:16Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:17Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:17Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:18Z WARN ] Audio playback callback has not been called longer than 5s. This likely indicates that we lost connection to the audio device. The failure may be transient. Trying to restart the playback stream.
[2025-10-21T22:40:18Z INFO ] Ejecting stream
[2025-10-21T22:40:18Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:18Z WARN ] Callback for audio stream tonari capture has not been called longer than 5s. This likely indicates that we lost connection to the audio device. The failure may be transient. Trying to restart the capture stream.
[2025-10-21T22:40:18Z INFO ] Ejecting stream
[2025-10-21T22:40:18Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:19Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:19Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:20Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:20Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:21Z INFO ] strohel timer fired, n: 1)
[2025-10-21T22:40:21Z INFO ] strohel timer fired, n: 1)

@strohel
Copy link
Copy Markdown
Member Author

strohel commented Oct 22, 2025

Closing in favor of #5 which fully hotfixes the problem.

@strohel strohel closed this Oct 22, 2025
@strohel strohel deleted the try-handling-device-removal branch October 22, 2025 13:23
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

Successfully merging this pull request may close these issues.

1 participant