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

Attempting to connect to Sonos from iOS AirPlay makes it unavailable on macOS #457

Open
dpo opened this issue Mar 24, 2023 · 18 comments
Open

Comments

@dpo
Copy link

dpo commented Mar 24, 2023

Hi. First of all, many thanks for developing this bridge, which is a life saver!

I'm on a M1 Mac running macOS 12.6.3. I have airupnp-macos-arm64-static from the master branch running via launchctl. When I first load the service, my Sonos Connect:Amp (an older model) becomes available, and I can connect to it from macOS without any problem.

However, if I try to connect to it from my iPhone or iPad via AirPlay, two things happen:

  1. the connection is never established
  2. I can no longer connect to it from macOS either afterwards.

I monitored the log file, but no messages are logged as the iPhone/iPad is trying to connect, or as macOS tries to connect afterwards.

Using launchctl unload ... / launchctl load ... again refreshes everything and the Connect:Amp becomes available again from macOS.

It used to be (at least in my case) that running your bridge would make the Sonos Connect:Amp available to iOS devices via AirPlay.

I should mention that I recently changed router, and that may be the issue.

What would be your recommendations to try and debug this situation?

For what it's worth, here's my log file: https://gist.github.com/dpo/a69d32b5a50b13315f9c571c0e06e6c7

Thanks in advance!

@dpo
Copy link
Author

dpo commented Mar 28, 2023

FWIW, in the log file, the one named "Office" is the older Connect:Amp (this one]. The one named "Living Room" is a new Connect:Amp (this one].

Here's an additional clue: if I run the executable directly from the command line with no specific options, I can connect to the older Amp from macOS. If I try to connect from iOS, it fails, and subsequently, trying to connect from macOS also fails (as happens when run as a service). However, trying to quit the program with C-c or exit does not work. The program hangs at

^C[10:52:59.860351] Stop:1148 terminate update thread ...
[10:52:59.860365] Stop:1153 flush renderers ...

Here's a log with debug information turned on in hopes something in there may be useful: https://gist.github.com/dpo/533db2a30ca044261ea69268a80b281f

@philippe44
Copy link
Owner

Isn't there more in the log? Best is to compress and attach it

@dpo
Copy link
Author

dpo commented Mar 28, 2023

There's nothing else in the first log. The second log keeps getting added to, but as I mentioned, when I try C-c or exit, the program hangs.

@philippe44
Copy link
Owner

But there is not even a playback session in that log

@dpo
Copy link
Author

dpo commented Mar 29, 2023

That's because I can't get connected. I can play from the Mac if I don't try to connect from iOS first.

@dpo
Copy link
Author

dpo commented Apr 1, 2023

Is there any additional info I can post to help?

@philippe44
Copy link
Owner

So if you launch manually the app, don't get any iOS to connect can you type exit on the bridge command line and does it exit. Then can you confirm that after one such successful connection, you cannot exit anymore.

It's likely a player that is stuck in a infinite wait loop and I have a few ideas where but I'd need to be more precise to not waste too much time

@dpo
Copy link
Author

dpo commented Apr 2, 2023

Here are the results of the experiments you asked:

  1. Launch manually, don't try to connect from iOS, type exit. Result: the app exits normally. Log: https://gist.github.com/dpo/9a484730d56c0d55be62c5507a7477f0
  2. Launch manually, don't try to connect from iOS, connect from macOS, play something, stop playing, type exit. Result: connection OK, playback OK, app exits normally. Log: https://gist.github.com/dpo/d047b8641140ecb7d9ebf7c1471639b5
  3. Launch manually, try to connect from iOS:
    • interestingly, when I tried yesterday, it worked. I was able to play back from my iPad. I disconnected, reconnected, and it all seemed to work. I launched the process as a service and it worked too. Here is yesterday's log file, where you can see playbacks happening: https://gist.github.com/dpo/7fade5f8cb30ca82bb7fc3aa3ec53b07. You can see a long break during the night. When I tried to reconnect this morning, I was no longer able to connect. The termination occurs because I run launchctl unload to stop the service. I restarted it but was not able to connect either. I eventually stopped it.
    • Today, I can no longer connect from iOS, and typing exit at the command line fails to exit. Log file: https://gist.github.com/dpo/1b2e1e9ef0989ebf8e4f5e8bd606cf53.

I don't believe anything changed on my system between yesterday and today. There were no OS updates.

I hope the above is helpful. If you would like me to run more experiments, please let me know.

Thank you.

@philippe44
Copy link
Owner

philippe44 commented Apr 2, 2023

Do you have some kind of firewall running on that Mac? The failure to connect and exit both point toward the same cause : the RTSP server is listening on a socket that is blocked from being accessed. It prevents iPhone or iPad to access and it also prevents the exit to happen because exiting requires an access to that same server.

@philippe44
Copy link
Owner

Ok - I've changed the way I wait for incoming connection, using a busy loop instead. There are pros and cons in doing that, but at least it should be more foolproof in term of system locking app because of obscure accept() failure.

Anyway, can you give a try to 1.0.17?

@dpo
Copy link
Author

dpo commented Apr 2, 2023

I downloaded 1.0.17 but it gets killed immediately upon launch by the OS:

~/bin ❯ ./airupnp-macos-arm64-static                                                                                                ✘ KILL 17:52:49
zsh: killed     ./airupnp-macos-arm64-static

@philippe44
Copy link
Owner

can you try the x86 version?

@dpo
Copy link
Author

dpo commented Apr 2, 2023

YEAH! Amazing! So far so good. I can play from both macOS and iOS. I can switch back and forth, and typing exit closes the program normally. Thank you!!!

I'll keep using it and report back if there are any more issues. Thank you so much!

@philippe44
Copy link
Owner

You're welcome. I don't know why the arm64 has an issue, it's my usual build system

@dpo
Copy link
Author

dpo commented Apr 3, 2023

Bad news. I'm back to the same place. This morning, I could not connect from either macOS or iOS. I unloaded and reloaded the service. I can connect from macOS, but not from iOS. The behavior is the same if I launch from the command line. However, typing exit exits cleanly.

As in my original message, a failed connection from iOS makes it impossible to connect from macOS afterwards.

Perhaps it has something to do with going to and waking from sleep?

Log: https://gist.github.com/dpo/b2797102be125fa1dcc922a6c958b332

@philippe44
Copy link
Owner

It's not a log

@dpo
Copy link
Author

dpo commented Apr 10, 2023

Apologies. Here's a log: https://gist.github.com/dpo/f6552c6bf8b5f1b684d6f28fc4f7878e

Today I could connect from macOS, but not from iOS. The playbacks in the log file are from macOS. There was no successful connection from iOS. Please let me know what else I can provide to make debugging easier.

@dpo
Copy link
Author

dpo commented May 2, 2023

I just tested the latest releases (both arm4 and x86_64). They both work fine on the Mac. I'm still unable to connect to my older Sonos Amp from iOS, but at least attempting to connect no longer blocks access for the Mac.

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