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

[Issue]: Docker network_mode: "host" binding problem #11557

Closed
1 task done
jumoog opened this issue May 12, 2024 · 24 comments
Closed
1 task done

[Issue]: Docker network_mode: "host" binding problem #11557

jumoog opened this issue May 12, 2024 · 24 comments
Labels
bug Something isn't working

Comments

@jumoog
Copy link

jumoog commented May 12, 2024

Please describe your bug

I have pulled the new version of the docker image and Jellyfin starts with an binding error message.

Reproduction Steps

My Docker Compose file that worked in 10.8.x

services:
    jellyfin:
        volumes:
            - '/home/jellyfin/config:/config'
            - '/home/jellyfin/cache:/cache'
            - '/home/media:/media'
        network_mode: "host"
        tmpfs:
           - /transcode

        environment:
            - TZ=Europe/Berlin
        image: 'jellyfin/jellyfin:latest'
        restart: "always"

Even if I change the port numbers in network.xml I still get the same message.

Jellyfin Version

10.9.0

if other:

No response

Environment

- Virtualization: Docker

Jellyfin logs

[2024-05-12 11:30:44.688 +02:00] [ERR] [1] Microsoft.Extensions.Hosting.Internal.Host: Hosting failed to start
System.IO.IOException: Failed to bind to address http://xxx.xxx.xxx.xxx:8096: address already in use.
 ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use
 ---> System.Net.Sockets.SocketException (98): Address already in use
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass28_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.EndpointsStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(ListenOptions[] listenOptions, AddressBindContext context, Func`2 useHttps, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)
[2024-05-12 11:30:44.692 +02:00] [ERR] [1] Main: Kestrel failed to start! This is most likely due to an invalid address or port bind - correct your bind configuration in network.xml and try again

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jumoog jumoog added the bug Something isn't working label May 12, 2024
@jellyfin-bot
Copy link
Contributor

Hi, it seems like your issue report has the following item(s) that need to be addressed:

  • The format of the environment section has been altered from the template.

This is an automated message, currently under testing. Please file an issue here if you encounter any problems.

@jumoog
Copy link
Author

jumoog commented May 12, 2024

Port 8096 is not in use by something else.

netstat -tulpn | grep 8096

returns nothing

@000MDK
Copy link

000MDK commented May 12, 2024

docker compose container with host, same problem since the update:

[10:03:07] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind addresses: ["127.0.0.1", "192.168.0.50", "172.21.0.1", "172.17.0.1", "172.24.0.1", "172.20.0.1", "172.23.0.1", "172.18.0.1", "172.25.0.1", "172.19.0.1", "172.26.0.1", "172.22.0.1", "192.168.0.50", "172.29.0.1", "172.30.0.1", "172.31.0.1"]
[10:03:07] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Remote IP filter is Allowlist
[10:03:07] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Filter list: []
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Fanart 10.0.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: FinTube 1.0.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Jellyfin Newsletters 0.6.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Open Subtitles 19.0.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Reports 15.0.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Skin Manager 2.0.1
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Subtitle Extract 2.0.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: TMDb 10.9.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Studio Images 10.9.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: OMDb 10.9.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: MusicBrainz 10.9.0.0
[10:03:27] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: AudioDB 10.9.0.0
[10:03:27] [INF] [1] Main: Kestrel is listening on 127.0.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 192.168.0.50
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.21.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.17.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.24.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.20.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.23.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.18.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.25.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.19.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.26.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.22.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 192.168.0.50
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.29.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.30.0.1
[10:03:27] [INF] [1] Main: Kestrel is listening on 172.31.0.1
[10:03:29] [WRN] [1] Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: The WebRootPath was not found: /wwwroot. Static files may be unavailable.
[10:03:29] [ERR] [1] Microsoft.Extensions.Hosting.Internal.Host: Hosting failed to start
System.IO.IOException: Failed to bind to address http://192.168.0.50:8096: address already in use.
 ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use
 ---> System.Net.Sockets.SocketException (98): Address already in use

@jumoog
Copy link
Author

jumoog commented May 12, 2024

If I do not use network_mode: "host" and bind to the IP, it works.

services:
    jellyfin:
        volumes:
            - '/home/jellyfin/config:/config'
            - '/home/jellyfin/cache:/cache'
            - '/home/media:/media'
        ports:
            - xxx.xxx.xxx.xxx:8920:8920/tcp
            - xxx.xxx.xxx.xxx:8096:8096/tcp
        tmpfs:
           - /transcode
        environment:
            - TZ=Europe/Berlin
        image: 'jellyfin/jellyfin:latest'
        restart: "always"

@jumoog jumoog changed the title [Issue]: Docker Host mode binding problem [Issue]: Docker network_mode: "host" binding problem May 12, 2024
@jumoog
Copy link
Author

jumoog commented May 12, 2024

Setting <IgnoreVirtualInterfaces>false</IgnoreVirtualInterfaces> in network.xml did not help.
I have now deleted network.xml and it is not recreated as the error occurs before it is created. However, system.xml is recreated.

@gnattu
Copy link
Member

gnattu commented May 12, 2024

It seems like you have two interfaces have the same IP.... interesting

@jellyfin-bot jellyfin-bot added this to Needs triage in Issue Triage for Main Repo May 12, 2024
@jumoog
Copy link
Author

jumoog commented May 12, 2024

It seems like you have two interfaces have the same IP.... interesting

I've noticed that I have the same IP address twice in the log. I have this on all my servers.

Server 1 enp41s0 xxx.xxx.xxx.xxx/32 and xxx.xxx.xxx.xxx/27
Server 2 enp41s0 xxx.xxx.xxx.xxx/32 and xxx.xxx.xxx.xxx/27

I have tailscale with subnet routes. I'll install a new Server without tailscale for testing.

@chi110r
Copy link

chi110r commented May 12, 2024

I got the same error on my unraid Docker setup. After some digging I got 2 interfaces with the same address

9: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d0:50:99:db:ac:9b brd ff:ff:ff:ff:ff:ff
    inet 10.192.168.22/24 metric 1 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::d250:99ff:fedb:ac9b/64 scope link
       valid_lft forever preferred_lft forever
124: shim-br0@br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether d0:50:99:db:ac:9b brd ff:ff:ff:ff:ff:ff
    inet 10.192.168.22/24 scope global shim-br0
       valid_lft forever preferred_lft forever

background: https://forums.unraid.net/topic/90688-shim-br0-networs-in-unraid/?do=findComment&comment=842950

maybe this helps

@000MDK
Copy link

000MDK commented May 12, 2024

I also have a shim for docker<->host networking.

@jumoog
Copy link
Author

jumoog commented May 12, 2024

2: enp41s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet xx.xx.xxx.131/32 scope global enp41s0
       valid_lft forever preferred_lft forever
    inet xx.xx.xxx.131/27 metric 100 brd xx.xx.xxx.159 scope global enp41s0
       valid_lft forever preferred_lft forever

@chi110r
Copy link

chi110r commented May 12, 2024

I fixed the shim thing by add the interface name to the VirtualInterfaceNames

...
  <IgnoreVirtualInterfaces>true</IgnoreVirtualInterfaces>
  <VirtualInterfaceNames>
    <string>veth</string>
    <string>shim-br0</string>
  </VirtualInterfaceNames>
...

now my Jellyfin works again.

@000MDK
Copy link

000MDK commented May 12, 2024

confirming @chi110r

@spupuz
Copy link

spupuz commented May 12, 2024

similar problem for me:

[11:54:33] [ERR] [1] Main: Kestrel failed to start! This is most likely due to an invalid address or port bind - correct your bind configuration in network.xml and try again

[11:54:33] [FTL] [1] Main: Error while starting server

@jumoog
Copy link
Author

jumoog commented May 12, 2024

@spupuz If you can compile it yourself, you can use my dirty hack https://github.com/jumoog/jellyfin/commit/9c8d42660dade818bc3d3cdd347fa6a250087cf5 as a temporary workaround.

@spupuz
Copy link

spupuz commented May 12, 2024

I don't have duplicated ip

@prahal
Copy link

prahal commented May 12, 2024

@spupuz do you have anything else using the 8096 port?
netstat -tulpn | grep 8096

@spupuz
Copy link

spupuz commented May 12, 2024

@spupuz do you have anything else using the 8096 port? netstat -tulpn | grep 8096

no, and if i start jellyfin docker without config as fresh it works without any problem, but i want to retain my configuration if possible.

@Killerherts
Copy link

I had this issue as well when migrating to 10.9 my solution was just to switch to bridge and declare my port directly

    ports:
      - 8096:8096
      - 8920:8920 #optional
      - 7359:7359/udp #optional
      - 1900:1900/udp #optional

No need to really get in and rebuild from source, just mod your docker to remove net-admin.

@gnattu
Copy link
Member

gnattu commented May 13, 2024

@spupuz do you have anything else using the 8096 port? netstat -tulpn | grep 8096

no, and if i start jellyfin docker without config as fresh it works without any problem, but i want to retain my configuration if possible.

Did you check if you have any incompatible plugins?

@libook
Copy link

libook commented May 13, 2024

"address already in use" problem.

It was working fine before upgrading to 10.9.0. After being automatically upgraded to 10.9.0 by Watchtower it won't start.

OS: unRAID
Docker container network in host mode.

Log:

[10:03:44] [INF] [1] Main: Jellyfin version: 10.9.1
[10:03:44] [INF] [1] Main: Environment Variables: ["[JELLYFIN_WEB_DIR, /jellyfin/jellyfin-web]", "[JELLYFIN_CACHE_DIR, /cache]", "[JELLYFIN_CONFIG_DIR, /config/config]", "[JELLYFIN_FFMPEG, /usr/lib/jellyfin-ffmpeg/ffmpeg]", "[JELLYFIN_DATA_DIR, /config]", "[JELLYFIN_LOG_DIR, /config/log]"]
[10:03:44] [INF] [1] Main: Arguments: ["/jellyfin/jellyfin.dll", "--ffmpeg", "/usr/lib/jellyfin-ffmpeg/ffmpeg"]
[10:03:44] [INF] [1] Main: Operating system: Debian GNU/Linux 12 (bookworm)
[10:03:44] [INF] [1] Main: Architecture: X64
[10:03:44] [INF] [1] Main: 64-Bit Process: True
[10:03:44] [INF] [1] Main: User Interactive: True
[10:03:44] [INF] [1] Main: Processor count: 16
[10:03:44] [INF] [1] Main: Program data path: /config
[10:03:44] [INF] [1] Main: Log directory path: /config/log
[10:03:44] [INF] [1] Main: Config directory path: /config/config
[10:03:44] [INF] [1] Main: Cache path: /cache
[10:03:44] [INF] [1] Main: Web resources path: /jellyfin/jellyfin-web
[10:03:44] [INF] [1] Main: Application directory: /jellyfin/
[10:03:44] [INF] [1] Emby.Server.Implementations.AppBase.BaseConfigurationManager: Setting cache path: /cache
[10:03:44] [INF] [1] Emby.Server.Implementations.ApplicationHost: Loading assemblies
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.Anime, Version=11.2012.600.2703, Culture=neutral, PublicKeyToken=null from /config/plugins/Anime_11.2012.600.2703/Jellyfin.Plugin.Anime.dll
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Skipping disabled plugin 9.0.0.0 of Bookshelf 
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Skipping disabled plugin 10.0.0.0 of Bookshelf 
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.CoverArtArchive, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Cover Art Archive_7.0.0.0/Jellyfin.Plugin.CoverArtArchive.dll
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly MetaBrainz.Common.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=be12cbb629c03021 from /config/plugins/Cover Art Archive_7.0.0.0/MetaBrainz.Common.Json.dll
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly MetaBrainz.MusicBrainz.CoverArt, Version=4.0.0.0, Culture=neutral, PublicKeyToken=be12cbb629c03021 from /config/plugins/Cover Art Archive_7.0.0.0/MetaBrainz.MusicBrainz.CoverArt.dll
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Skipping disabled plugin 1.0.7.0 of Douban 
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.OpenSubtitles, Version=19.0.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Open Subtitles_19.0.0.0/Jellyfin.Plugin.OpenSubtitles.dll
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded assembly Jellyfin.Plugin.SkinManager, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Skin Manager_2.0.1/Jellyfin.Plugin.SkinManager.dll
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Skipping disabled plugin 9.0.0.0 of TheTVDB 
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Skipping disabled plugin 10.0.0.0 of TheTVDB 
[10:03:44] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Skipping disabled plugin 11.0.0.0 of Webhook 
[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN addresses: ["127.0.0.1/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN exclusions: []
[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using LAN addresses: ["127.0.0.1/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind addresses: ["127.0.0.1", "192.168.50.49", "172.27.0.1", "172.26.0.1", "172.20.0.1", "172.22.0.1", "192.168.96.1", "172.18.0.1", "172.17.0.1", "172.19.0.1", "172.23.0.1", "172.21.0.1", "192.168.50.49"]
[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Remote IP filter is Allowlist
[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Filter list: []
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Anime 11.2012.600.2703
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Cover Art Archive 7.0.0.0
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Open Subtitles 19.0.0.0
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Skin Manager 2.0.1
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: TMDb 10.9.1.0
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: Studio Images 10.9.1.0
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: OMDb 10.9.1.0
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: MusicBrainz 10.9.1.0
[10:03:50] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: AudioDB 10.9.1.0
[10:03:50] [WRN] [1] Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository: Using an in-memory repository. Keys will not be persisted to storage.
[10:03:50] [WRN] [1] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
[10:03:50] [INF] [1] Main: Kestrel is listening on 127.0.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 192.168.50.49
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.27.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.26.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.20.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.22.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 192.168.96.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.18.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.17.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.19.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.23.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 172.21.0.1
[10:03:50] [INF] [1] Main: Kestrel is listening on 192.168.50.49
[10:03:50] [WRN] [1] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: No XML encryptor configured. Key {f404d974-9c8b-4b65-a1c1-a493514dc5a3} may be persisted to storage in unencrypted form.
[10:03:51] [INF] [1] Jellyfin.Networking.PortForwardingHost: Starting NAT discovery
[10:03:51] [WRN] [1] Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: The WebRootPath was not found: /wwwroot. Static files may be unavailable.
[10:03:51] [ERR] [1] Microsoft.Extensions.Hosting.Internal.Host: Hosting failed to start
System.IO.IOException: Failed to bind to address http://192.168.50.49:8096: address already in use.
 ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use
 ---> System.Net.Sockets.SocketException (98): Address already in use
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass28_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.EndpointsStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(ListenOptions[] listenOptions, AddressBindContext context, Func`2 useHttps, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
[10:03:51] [ERR] [1] Main: Kestrel failed to start! This is most likely due to an invalid address or port bind - correct your bind configuration in network.xml and try again
[10:03:51] [FTL] [1] Main: Error while starting server
System.IO.IOException: Failed to bind to address http://192.168.50.49:8096: address already in use.
 ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use
 ---> System.Net.Sockets.SocketException (98): Address already in use
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass28_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.EndpointsStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(ListenOptions[] listenOptions, AddressBindContext context, Func`2 useHttps, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)
[10:03:51] [INF] [1] Main: Running query planner optimizations in the database... This might take a while
[10:03:51] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing CoreAppHost
[10:03:51] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing MusicBrainzArtistProvider
[10:03:51] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing MusicBrainzAlbumProvider
[10:03:51] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing CoverArtArchiveImageProvider
[10:03:51] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing PluginManager

network.xml

<?xml version="1.0" encoding="utf-8"?>
<NetworkConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <BaseUrl />
  <EnableHttps>false</EnableHttps>
  <RequireHttps>false</RequireHttps>
  <CertificatePath />
  <CertificatePassword />
  <InternalHttpPort>8096</InternalHttpPort>
  <InternalHttpsPort>8920</InternalHttpsPort>
  <PublicHttpPort>8096</PublicHttpPort>
  <PublicHttpsPort>8920</PublicHttpsPort>
  <AutoDiscovery>true</AutoDiscovery>
  <EnableUPnP>true</EnableUPnP>
  <EnableIPv4>true</EnableIPv4>
  <EnableIPv6>false</EnableIPv6>
  <EnableRemoteAccess>true</EnableRemoteAccess>
  <LocalNetworkSubnets />
  <LocalNetworkAddresses />
  <KnownProxies />
  <IgnoreVirtualInterfaces>true</IgnoreVirtualInterfaces>
  <VirtualInterfaceNames>
    <string>veth</string>
  </VirtualInterfaceNames>
  <EnablePublishedServerUriByRequest>false</EnablePublishedServerUriByRequest>
  <PublishedServerUriBySubnet />
  <RemoteIPFilter />
  <IsRemoteIPFilterBlacklist>false</IsRemoteIPFilterBlacklist>
</NetworkConfiguration>

None returned by netstat -tulpn | grep 8096. So no other process occupies this port.

Is it possible that Jellyfin binds itself to the same port twice during startup?

@gnattu
Copy link
Member

gnattu commented May 13, 2024

The original issue about having multiple interfaces sharing same IP is going to be resolved by #11587.

If you don't have interfaces sharing the same IP, then you are affected by a different issue and please file a new one with complete log and environment info so we can look at it.

@jumoog
Copy link
Author

jumoog commented May 13, 2024

Your fix is working! Thank you very much!

@jumoog jumoog closed this as completed May 13, 2024
Issue Triage for Main Repo automation moved this from Needs triage to Closed/Done May 13, 2024
@jumoog jumoog reopened this May 17, 2024
Issue Triage for Main Repo automation moved this from Closed/Done to Needs triage May 17, 2024
@jumoog jumoog closed this as completed May 17, 2024
Issue Triage for Main Repo automation moved this from Needs triage to Closed/Done May 17, 2024
@prahal
Copy link

prahal commented May 19, 2024

@libook your logs shows 192.168.50.49 twice:

[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using LAN addresses: ["127.0.0.1/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind addresses: ["127.0.0.1", "192.168.50.49", "172.27.0.1", "172.26.0.1", "172.20.0.1", "172.22.0.1", "192.168.96.1", "172.18.0.1", "172.17.0.1", "172.19.0.1", "172.23.0.1", "172.21.0.1", "192.168.50.49"]

Maybe netstat does not shows up jellyfin port because jellyfin stop before you check it's port.
Could you show your IP config (on Linux ip a?

@libook
Copy link

libook commented May 20, 2024

@libook your logs shows 192.168.50.49 twice:

[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using LAN addresses: ["127.0.0.1/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
[10:03:44] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind addresses: ["127.0.0.1", "192.168.50.49", "172.27.0.1", "172.26.0.1", "172.20.0.1", "172.22.0.1", "192.168.96.1", "172.18.0.1", "172.17.0.1", "172.19.0.1", "172.23.0.1", "172.21.0.1", "192.168.50.49"]

Maybe netstat does not shows up jellyfin port because jellyfin stop before you check it's port. Could you show your IP config (on Linux ip a?

@prahal Hi,thanks for your view.
Jellyfin crashed after throw the error. So I can not catch the port of Jellyfin. I can just show that there is no other process is binding this port.
I have upgraded Jellyfin to 10.9.2. It solved this problem. It seems #11587 is the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

9 participants