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

emby: DLNA components fail to start/run #24093

Closed
dtzWill opened this issue Mar 20, 2017 · 6 comments
Closed

emby: DLNA components fail to start/run #24093

dtzWill opened this issue Mar 20, 2017 · 6 comments

Comments

@dtzWill
Copy link
Member

dtzWill commented Mar 20, 2017

Issue description

After enabling the emby service on Nix 17.03, things seem to mostly work great (hooray!) but DLNA doesn't work. Investigating a bit this seems to be due to some problem while creating/configuring the necessary sockets.

Observed behavior is I'm unable to see DLNA devices on the network.

Relevant bit from server log:

2017-03-19 17:13:54.2491 Info App: Starting entry point Emby.Dlna.DlnaProfileEntryPoint
2017-03-19 17:13:54.2491 Info App: Entry point completed: Emby.Dlna.DlnaProfileEntryPoint. Duration: 2.6E-05 seconds
2017-03-19 17:13:54.2491 Info App: Starting entry point Emby.Dlna.Main.DlnaEntryPoint
2017-03-19 17:13:54.3161 Error Dlna: Error starting ssdp handlers
	*** Error Report ***
	Version: 3.2.4.0
	Command line: /nix/store/2x3kyck9gxcfnmxq1ippx9vn1br4gkqp-emby-3.2.4/bin/MediaBrowser.Server.Mono.exe -ffmpeg /nix/store/c9wwsf2sl3yggh15zqa1sxcgkvy831bq-ffmpeg-3.1.7-bin/bin/ffmpeg -ffprobe /nix/store/c9wwsf2sl3yggh15zqa1sxcgkvy831bq-ffmpeg-3.1.7-bin/bin/ffprobe
	Operating system: Unix 4.9.13.0
	64-Bit OS: True
	64-Bit Process: True
	Mono: 4.6.0 (Stable 4.6.0.182/3ed2bba Sat Mar 18 16:23:51 UTC 2017)
	Processor count: 8
	Program data path: /var/lib/emby/ProgramData-Server
	Application directory: /nix/store/2x3kyck9gxcfnmxq1ippx9vn1br4gkqp-emby-3.2.4/bin
	System.Net.Sockets.SocketException (0x80004005): Protocol option not supported
	  at System.Net.Sockets.Socket.SetSocketOption (System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, System.Int32 optionValue) [0x0006d] in <ae4a5672e28e4473b7bfd6b7dc9718e2>:0 
	  at Emby.Common.Implementations.Net.SocketFactory.CreateUdpMulticastSocket (System.String ipAddress, System.Int32 multicastTimeToLive, System.Int32 localPort) [0x0006c] in <8e9ecee01d34431081e6e23647892497>:0 
	System.Net.Sockets.SocketException
	  at System.Net.Sockets.Socket.SetSocketOption (System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, System.Int32 optionValue) [0x0006d] in <ae4a5672e28e4473b7bfd6b7dc9718e2>:0 
	  at Emby.Common.Implementations.Net.SocketFactory.CreateUdpMulticastSocket (System.String ipAddress, System.Int32 multicastTimeToLive, System.Int32 localPort) [0x0006c] in <8e9ecee01d34431081e6e23647892497>:0 
	
2017-03-19 17:13:54.3178 Error Dlna: Error registering endpoint
	*** Error Report ***
	Version: 3.2.4.0
	Command line: /nix/store/2x3kyck9gxcfnmxq1ippx9vn1br4gkqp-emby-3.2.4/bin/MediaBrowser.Server.Mono.exe -ffmpeg /nix/store/c9wwsf2sl3yggh15zqa1sxcgkvy831bq-ffmpeg-3.1.7-bin/bin/ffmpeg -ffprobe /nix/store/c9wwsf2sl3yggh15zqa1sxcgkvy831bq-ffmpeg-3.1.7-bin/bin/ffprobe
	Operating system: Unix 4.9.13.0
	64-Bit OS: True
	64-Bit Process: True
	Mono: 4.6.0 (Stable 4.6.0.182/3ed2bba Sat Mar 18 16:23:51 UTC 2017)
	Processor count: 8
	Program data path: /var/lib/emby/ProgramData-Server
	Application directory: /nix/store/2x3kyck9gxcfnmxq1ippx9vn1br4gkqp-emby-3.2.4/bin
	System.NullReferenceException: Object reference not set to an instance of an object
	  at Emby.Dlna.Main.DlnaEntryPoint+<RegisterServerEndpoints>d__36.MoveNext () [0x00044] in <51d32b087d0a4188b54ba80a5d0bd5df>:0 
	--- End of stack trace from previous location where exception was thrown ---
	  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <4952428b354e47caa24a27798d61cd88>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <4952428b354e47caa24a27798d61cd88>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <4952428b354e47caa24a27798d61cd88>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <4952428b354e47caa24a27798d61cd88>:0 
	  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <4952428b354e47caa24a27798d61cd88>:0 
	  at Emby.Dlna.Main.DlnaEntryPoint+<StartDlnaServer>d__35.MoveNext () [0x0006f] in <51d32b087d0a4188b54ba80a5d0bd5df>:0 
	System.NullReferenceException
	  at Emby.Dlna.Main.DlnaEntryPoint+<RegisterServerEndpoints>d__36.MoveNext () [0x00044] in <51d32b087d0a4188b54ba80a5d0bd5df>:0 
	--- End of stack trace from previous location where exception was thrown ---
	  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <4952428b354e47caa24a27798d61cd88>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <4952428b354e47caa24a27798d61cd88>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <4952428b354e47caa24a27798d61cd88>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <4952428b354e47caa24a27798d61cd88>:0 
	  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <4952428b354e47caa24a27798d61cd88>:0 
	  at Emby.Dlna.Main.DlnaEntryPoint+<StartDlnaServer>d__35.MoveNext () [0x0006f] in <51d32b087d0a4188b54ba80a5d0bd5df>:0 
	
2017-03-19 17:13:54.3178 Info App: Entry point completed: Emby.Dlna.Main.DlnaEntryPoint. Duration: 0.068887 seconds

I tried using different versions of Emby (including latest) and Mono, but no luck. In particular it seems Emby requires Mono 4.6.2 while we are using 4.6.0--but bumping our mono version didn't change this behavior, neither did using 4.4 or 4.2 (it failed to run with 4.2 if I remember correctly).

Steps to reproduce

  • Enable emby service in configuration.nix
  • Go to http://localhost:8096, complete setup wizard
  • Browse to server dashboard/settings and inspect most recent server log
  • (Alternatively, try to use DLNA functionality)

Technical details

  • System: (NixOS: nixos-version, Ubuntu/Fedora: lsb_release -a, ...)
    17.03beta501.acb7958
  • Nix version: (run nix-env --version)
    nix-env (Nix) 1.11.7
  • Nixpkgs version: (run nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion)
    "17.03beta501.acb7958"
@joachifm
Copy link
Contributor

cc @fadenb

@fadenb
Copy link
Contributor

fadenb commented Mar 21, 2017

@dtzWill can confirm that it is not working. IIRC this has always been the issue on NixOS.
I believe this is an issue in Emby on Linux and not NixOS specific but I will look into it (probably not this week)

@dtzWill
Copy link
Member Author

dtzWill commented Mar 21, 2017

Thanks for the confirmation and information. My investigation efforts suggested it was an Emby-on-Linux thing as well.

Here's the source from Emby around where the exception is thrown:

https://github.com/MediaBrowser/Emby/blob/6b52b8268148778bf6844f61d89bca37ccf547ef/Emby.Common.Implementations/Net/SocketFactory.cs#L157

I'm a mono noob so I'm not in a position to debug this properly but this might be an instance of:

https://bugzilla.xamarin.com/show_bug.cgi?id=36941

Which basically suggests that the way they set the MulticastTimeToLive socket option doesn't work on Linux (which AFAICT seems to be a mono bug but what do I know), and may be fixed with the suggested workaround (?).

EDIT: I've tracked down the problem a bit more, commented on the linked upstream bug.. let's see what they have to say :)

@dtzWill
Copy link
Member Author

dtzWill commented Mar 24, 2017

No response upstream yet, but I tried to reproduce the bug using a "known-good" copy of mono, so I tried it with a few versions of the ('mono' docker image)[https://hub.docker.com/_/mono/] and all of them worked where ours does not.

So maybe this is somehow a bug in how we build mono?

@dtzWill
Copy link
Member Author

dtzWill commented Mar 24, 2017

After a fair bit of debugging, I've got DLNA working now! 😀

The problem originates with our currently outdated copy of "/etc/protocols", see my comment on one of the PR's addressing this issue for an explanation of how this broke things: #24053 (comment)

Just fired up my ps4 and it had no trouble seeing my Emby server right away \o/.

What a doozy!

@dtzWill
Copy link
Member Author

dtzWill commented Mar 28, 2017

Closing, fixed when #24053 was merged. 👍

@dtzWill dtzWill closed this as completed Mar 28, 2017
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

3 participants