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

Discovery is broken in Ruby 2.1 #23

Open
fliiiix opened this issue Jan 6, 2014 · 17 comments
Open

Discovery is broken in Ruby 2.1 #23

fliiiix opened this issue Jan 6, 2014 · 17 comments

Comments

@fliiiix
Copy link

fliiiix commented Jan 6, 2014

Timeout error; switching to the default IP

I got always this error, and I don't understand why.

@soffes
Copy link
Collaborator

soffes commented Feb 4, 2014

Working on a fix.

@soffes
Copy link
Collaborator

soffes commented Feb 4, 2014

For me, this works fine with Ruby 2.0. In 2.1, it always times out. Not sure why.

@jasperla I tried your patch but it didn't work for me. I'm on Mac OS X running Ruby 2.1-p0.

@jasperla
Copy link
Collaborator

jasperla commented Feb 4, 2014

I don't need that patch on Mac OS X with ruby 2.0. It was committed to OpenBSD as the setsockopt(2) flag needs to be an unsigned char instead of an int. It was a shot in the dark with regard to the issue you're seeing.

@soffes
Copy link
Collaborator

soffes commented Feb 4, 2014

Oh ha. Well now that I know it's a 2.1 issue, it should be easier to track down. Switched to 2.0 to go through some of these issues for now.

@jasperla
Copy link
Collaborator

jasperla commented Feb 4, 2014

With 2.1 I think the way to set the socket options changed, i.e. the MULTICAST_TTL.
So you'd have to use the Socket::Option.ipv4_multicast_ttl method for portable behavior,

@soffes
Copy link
Collaborator

soffes commented Feb 4, 2014

Tried

@socket.setsockopt Socket::Option.ipv4_multicast_ttl(2)

with no luck

@fliiiix
Copy link
Author

fliiiix commented Feb 4, 2014

Hey I try to run the latest version with rake console on different ruby versions with no luck.
My OS is Fedora 20 with 3.12.7-300.fc20.x86_64 kernel. If you need some additional information's just ask.

1.9.3-p484 :001 > system = Sonos::System.new
Timed out...
 => #<Sonos::System:0x0000000212f208 @topology=[], @groups=[], @devices=[]> 
2.0.0-p353 :001 > system = Sonos::System.new
Timed out...
 => #<Sonos::System:0x00000002f49230 @topology=[], @groups=[], @devices=[]> 
2.1.0 :001 > system = Sonos::System.new
Timed out...
 => #<Sonos::System:0x000000013926b8 @topology=[], @groups=[], @devices=[]> 

Good luck with fixing 👍

@soffes
Copy link
Collaborator

soffes commented Feb 4, 2014

Thanks @fliiiix! So frustrating. For me 2.0.0-p353 works just fine.

@fliiiix
Copy link
Author

fliiiix commented Feb 4, 2014

I debug it with wireshark, it's really a ugly piece of software.
Turns out I got an ICMP package Type 3 Code 10 which mean Destination Unreachable - Host administratively prohibited.

This sounds like firewall right? I disable my firewall. And now it work for me with:

  • 2.0.0-p353
  • 2.1.0
  • 2.1.0-preview2

So now I try to figure out how I need to configure my firewall to allow these traffic.
But these don't explain why for you 2.0 work and 2.1 not. 😕

@dspeake
Copy link

dspeake commented Feb 21, 2014

I have the same issue whilst running an app within a docker container (using dokku) so my guess is that it is a routing issue. I've disabled ufw, and I can ping the Sonos box from within the container, but it still doesn't discover. My guess is because the container runs in a different/virtual network.

I've just changed my method to:

system = Sonos::System.new(Sonos::Discovery.new(2, ip).topology)

@michalzielanski
Copy link

For me, this works fine with Ruby 2.1 (2.1.0p0 (2013-12-25 revision 44422) from MacPorts). Mac OS X 10.9.1, Sonos 0.3.5 from Ruby Gems.

@gotwalt
Copy link
Owner

gotwalt commented Jun 21, 2014

ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0] (current 2.1.2 head from rbenv) works fine out of the box. Suspect this was a regression fixed some time between the opening of this ticket and now.

@jasperla
Copy link
Collaborator

jasperla commented Oct 2, 2014

ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-openbsd] works fine for me still with sonos-0.3.6, so I'm inclined to close this issue.

@soffes ?

@estiens
Copy link

estiens commented Dec 1, 2015

@dspeake: Your method alteration with the ip address of my router as a string works for me on OSX 10.10.5 and ruby 2.0.0p594

@estiens
Copy link

estiens commented Dec 15, 2015

Hmm, maybe I spoke to soon or the most recent Sonos update broke it. Now auto-discovery is broken and the manual IP workaround is broken for me on Ruby 2.0, 2.1, and 2.2

@estiens
Copy link

estiens commented Jan 9, 2016

This now works for me

system = Sonos::System.new(Sonos::Discovery.new(2, '192.168.0.103').topology) where 192.168.0.103 is the IP address of the speaker I have hardwired to my router. No other workarounds seem to work.

@sudoaza
Copy link

sudoaza commented Oct 5, 2016

ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

with the firewall off works, with the firewall on doesn't.

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

No branches or pull requests

8 participants