elcuervo / airplay

Airplay bindings to Ruby
MIT License
1.07k stars 71 forks source link

Crash in dnssd #75

Open tazjin opened 10 years ago

tazjin commented 10 years ago

Hej!

When I try to run any airplay-cli command (e.g. air list) I get an immediate crash in dnssd.

> air list
D, [2014-02-02T15:07:18.330339 #13842] DEBUG -- : Terminating 4 actors...
/home/vincent/.gem/ruby/2.1.0/gems/dnssd-2.0/lib/dnssd/service.rb:64:in `_browse': DNSSD operation failed with unrecognized error code: -65537 (DNSSD::UnknownError)
    from /home/vincent/.gem/ruby/2.1.0/gems/dnssd-2.0/lib/dnssd/service.rb:64:in `browse'
    from /home/vincent/.gem/ruby/2.1.0/gems/dnssd-2.0/lib/dnssd.rb:178:in `run'
    from /home/vincent/.gem/ruby/2.1.0/gems/dnssd-2.0/lib/dnssd.rb:86:in `browse!'
    from /home/vincent/.gem/ruby/2.1.0/gems/airplay-1.0.2/lib/airplay/browser.rb:25:in `block in browse'
    from /usr/lib/ruby/2.1.0/timeout.rb:82:in `block in timeout'
    from /usr/lib/ruby/2.1.0/timeout.rb:70:in `catch'
    from /usr/lib/ruby/2.1.0/timeout.rb:70:in `timeout'
    from /usr/lib/ruby/2.1.0/timeout.rb:111:in `timeout'
    from /home/vincent/.gem/ruby/2.1.0/gems/airplay-1.0.2/lib/airplay/browser.rb:24:in `browse'
    from /home/vincent/.gem/ruby/2.1.0/gems/airplay-1.0.2/lib/airplay.rb:34:in `browse'
    from /home/vincent/.gem/ruby/2.1.0/gems/airplay-1.0.2/lib/airplay.rb:62:in `devices'
    from /home/vincent/.gem/ruby/2.1.0/gems/airplay-1.0.2/lib/airplay/cli.rb:46:in `list'
    from /home/vincent/.gem/ruby/2.1.0/gems/clap-1.0.0/lib/clap.rb:35:in `call'
    from /home/vincent/.gem/ruby/2.1.0/gems/clap-1.0.0/lib/clap.rb:35:in `run'
    from /home/vincent/.gem/ruby/2.1.0/gems/clap-1.0.0/lib/clap.rb:6:in `run'
    from /home/vincent/.gem/ruby/2.1.0/gems/airplay-cli-1.0.1/bin/air:8:in `<top (required)>'
    from /home/vincent/bin/air:23:in `load'
    from /home/vincent/bin/air:23:in `<main>'

Bonjour service discovery through something like avahi-discover-standalone works fine: bonjour

This could be related to this issue in dnssd which seems to have the same error code, and this issue in this project. There doesn't seem to be a dot in any of the result names though.

Cheers, Vincent

elcuervo commented 10 years ago

Thank you for reporting the issue. I'm looking at it now. I will update shortly :)

tazjin commented 10 years ago

On further investigation this happens to me with just DNSSD as well:

~/s/a/l/airplay $ irb
irb(main):001:0> require "dnssd"
=> true
irb(main):002:0> DNSSD.browse!("_airplay._tcp.")
DNSSD::UnknownError: DNSSD operation failed with unrecognized error code: -65537
    from /home/vincent/.gem/ruby/2.1.0/gems/dnssd-2.0/lib/dnssd/service.rb:64:in `_browse'
    from /home/vincent/.gem/ruby/2.1.0/gems/dnssd-2.0/lib/dnssd/service.rb:64:in `browse'
    from /home/vincent/.gem/ruby/2.1.0/gems/dnssd-2.0/lib/dnssd.rb:178:in `run'
    from /home/vincent/.gem/ruby/2.1.0/gems/dnssd-2.0/lib/dnssd.rb:86:in `browse!'
    from (irb):2
    from /usr/bin/irb:11:in `<main>'

So it's most likely not related to this library. I might file this against dnssd itself.

//V

elcuervo commented 10 years ago

If you add the issue please cross reference it to this issue. I'll also work in a fix

Aesthetikx commented 2 years ago

As an anecdote, on FreeBSD I was seeing this error as well, but after reading this: https://www.mythtv.org/wiki/AirTunes/AirPlay#Not_seeing_AirPlay_device_in_iTunes it turns out that DNSSerivceBrowse returns -65537 when the avahi daemon is not running, so this was fixed by starting the avahi-daemon service. Not sure why it wouldn't return kDNSServiceErr_ServiceNotRunning instead?