AirenSoft/OvenMediaEngine

No binding on 3333 when ipv6 is activated.

Closed this issue · 2 comments

Describe the bug

When activating IPv6 on origin.xml (server.xml), i get the following error in the logs:

W [OvenMediaEngine:1] HTTP.Server | http_server_manager.cpp:212  | Invalid address: ::, port: 3333 (HTTP) - [SocketAddress] Could not resolve name: "::" (-9)

To Reproduce
Steps to reproduce the behavior:

  1. Set Server.xml as follows '...'
<?xml version="1.0" encoding="UTF-8" ?>
<Server version="8">
	<Name>OvenMediaEngine</Name>
	<!-- Host type (origin/edge) -->
	<Type>origin</Type>
	<!-- Specify IP address to bind (* means all IPs) -->
	<IP>*</IP>
	<!-- Listening the bind ports on IPv6 interfaces -->
	<IP>::</IP>
	<PrivacyProtection>false</PrivacyProtection>
	<!-- 
	To get the public IP address(mapped address of stun) of the local server. 
	This is useful when OME cannot obtain a public IP from an interface, such as AWS or docker environment. 
	If this is successful, you can use ${PublicIP} in your settings.
	-->
	<StunServer>stun.ovenmediaengine.com:13478</StunServer>

	<Modules>
		<!-- 
		Currently OME only supports h2 like all browsers do. Therefore, HTTP/2 only works on TLS ports.			
		-->
		<HTTP2>
			<Enable>true</Enable>
		</HTTP2>

		<LLHLS>
			<Enable>false</Enable>
		</LLHLS>

		<!-- P2P works only in WebRTC and is experiment feature -->
		<P2P>
			<!-- disabled by default -->
			<Enable>false</Enable>
			<MaxClientPeersPerHostPeer>2</MaxClientPeersPerHostPeer>
		</P2P>
	</Modules>

	<!-- Settings for the ports to bind -->
	<Bind>
		<!-- Enable this configuration if you want to use API Server -->
		<Managers>
			<API>
				<Port>${env:OME_API_PORT:8081}</Port>
				<WorkerCount>1</WorkerCount>
			</API>
		</Managers>
		<Providers>
			<!-- Pull providers -->
			<RTSPC>
				<WorkerCount>1</WorkerCount>
			</RTSPC>
			<OVT>
				<WorkerCount>1</WorkerCount>
			</OVT>
			<!-- Push providers -->
			<RTMP>
				<Port>${env:OME_RTMP_PROV_PORT:1935}</Port>
				<WorkerCount>1</WorkerCount>
			</RTMP>
			<SRT>
				<Port>${env:OME_SRT_PROV_PORT:9999}</Port>
				<WorkerCount>1</WorkerCount>
			</SRT>
			<!--
			<MPEGTS>
					<- Listen on port 4000
					This is just a demonstration to show that you can configure the port in several ways ->
					<Port>${env:OME_MPEGTS_PROV_PORT:4000-4001,4004,4005/udp}</Port>
				<Port>${env:OME_MPEGTS_PROV_PORT:4000-4005/udp}</Port>
			</MPEGTS>
			-->
			<WebRTC>
				<Signalling>
					<Port>${env:OME_WEBRTC_SIGNALLING_PORT:3333}</Port>
					<TLSPort>${env:OME_WEBRTC_SIGNALLING_TLS_PORT:3334}</TLSPort>
					<WorkerCount>1</WorkerCount>
				</Signalling>
				<IceCandidates>
					<IceCandidate>*:${env:OME_WEBRTC_CANDIDATE_PORT:10000-10009/udp}</IceCandidate>
					<IceCandidate>[::]:${env:OME_WEBRTC_CANDIDATE_PORT:10000-10009/udp}</IceCandidate>
					<TcpRelay>*:${env:OME_WEBRTC_TCP_RELAY_PORT:3478}</TcpRelay>
					<TcpRelay>[::]:${env:OME_WEBRTC_TCP_RELAY_PORT:3478}</TcpRelay>
					<TcpForce>true</TcpForce>
					<TcpRelayWorkerCount>1</TcpRelayWorkerCount>
				</IceCandidates>
			</WebRTC>
		</Providers>

		<Publishers>
			<!-- The Thumbnail provider-->
			<Thumbnail>
				<Port>${env:OME_THUMBNAIL_PROV_PORT:8082}</Port>
			</Thumbnail>
			<!-- The OVT is protocol for ORIGIN-EDGE -->
			<OVT>
				<Port>${env:OME_ORIGIN_PORT:9000}</Port>
				<WorkerCount>1</WorkerCount>
			</OVT>
			<!-- 
			<LLHLS>
				OME only supports h2, so LLHLS works over HTTP/1.1 on non-TLS port. 
				Note that LLHLS runs higher performance over HTTP/2.
				Therefore, it is recommended to use TLS Port.
				<Port>${env:OME_LLHLS_STREAM_PORT:3333}</Port>
				<TLSPort>${env:OME_LLHLS_STREAM_TLS_PORT:3334}</TLSPort>
				<WorkerCount>1</WorkerCount>
			</LLHLS>
			-->
			<WebRTC>
				<Signalling>
					<Port>${env:OME_WEBRTC_SIGNALLING_PORT:3333}</Port>
					<TLSPort>${env:OME_WEBRTC_SIGNALLING_TLS_PORT:3334}</TLSPort>
					<WorkerCount>1</WorkerCount>
				</Signalling>
				<IceCandidates>
					<IceCandidate>${env:OME_WEBRTC_CANDIDATE_IP:*}:${env:OME_WEBRTC_CANDIDATE_PORT:10000-10004/udp}</IceCandidate>
					<TcpRelay>${env:OME_WEBRTC_CANDIDATE_IP:*}:${env:OME_WEBRTC_TCP_RELAY_PORT:3478}</TcpRelay>
					<TcpForce>true</TcpForce>
					<TcpRelayWorkerCount>1</TcpRelayWorkerCount>
				</IceCandidates>
			</WebRTC>
		</Publishers>
	</Bind>
	<Managers>
		<Host>
			<Names>
				<Name>*</Name>
			</Names>
		</Host>
		<API>
			<AccessToken>admin:${env:ADMISSION_SERVER_SECRET_KEY:password}</AccessToken>
			<CrossDomains>
				<Url>*</Url>
			</CrossDomains>
		</API>
	</Managers>
	<VirtualHosts>
		<!--
			You can include multiple XML files by doing the following:
			<VirtualHost include="sites-enabled/*.xml" />
		-->
		<VirtualHost include="VHost*.xml" />
		<VirtualHost>
			<Name>default</Name>
			<!--Distribution is a value that can be used when grouping the same vhost distributed across multiple servers. This value is output to the events log, so you can use it to aggregate statistics. -->
			<Distribution>ovenmediaengine.com</Distribution>
			
			<!-- Settings for multi ip/domain and TLS -->
			<Host>
				<Names>
					<!-- Host names
						<Name>stream1.airensoft.com</Name>
						<Name>stream2.airensoft.com</Name>
						<Name>*.sub.airensoft.com</Name>
						<Name>192.168.0.1</Name>
					-->
					<Name>*</Name>
				</Names>
				<TLS>
					<CertPath>./cert.crt</CertPath>
					<KeyPath>./cert.key</KeyPath>
					<ChainCertPath>./cert.ca-bundle</ChainCertPath>
				</TLS>
			</Host>

			<!-- Refer https://airensoft.gitbook.io/ovenmediaengine/signedpolicy
			<SignedPolicy>
				<PolicyQueryKeyName>policy</PolicyQueryKeyName>
				<SignatureQueryKeyName>signature</SignatureQueryKeyName>
				<SecretKey>aKq#1kj</SecretKey>

				<Enables>
					<Providers>rtmp,webrtc,srt</Providers>
					<Publishers>webrtc,hls,llhls,dash,lldash</Publishers>
				</Enables>
			</SignedPolicy>
			-->

			<!--
			<OriginMapStore>
				In order to use OriginMap, you must enable OVT Publisher in Origin and OVT Provider in Edge.
				<RedisServer>
					<Host>192.168.0.160:6379</Host>
					<Auth>!@#ovenmediaengine</Auth>
				</RedisServer>
				
				This is only needed for the origin server and used to register the ovt address of the stream. 
				<OriginHostName>${*}</OriginHostName>
			</OriginMapStore>
			-->

			<!-- Default CORS Settings -->
			<CrossDomains>
				<Url>*</Url>
			</CrossDomains>

			<AdmissionWebhooks>
				<ControlServerUrl>http://${env:ADMISSION_SERVER_URL:api}/stream/admission_request</ControlServerUrl>
				<SecretKey>${env:ADMISSION_SERVER_SECRET_KEY:secret}</SecretKey>
				<Timeout>3000</Timeout>
				<Enables>
					<Publishers>webrtc</Publishers>
				</Enables>
			</AdmissionWebhooks>

			<!-- Settings for applications -->
			<Applications>
				<Application>
					<Name>app</Name>
					<!-- Application type (live/vod) -->
					<Type>live</Type>
					<OutputProfiles>
						<!--  This option is deprecated. Please use the 'HWAccels' option. -->
						<!-- 
							<HardwareAcceleration>false</HardwareAcceleration>
						-->

						<!-- Enable this configuration if you want to hardware acceleration using GPU -->
						<HWAccels>
							<Decoder>
									<Enable>false</Enable>
									<!-- 
										Setting for Hardware Modules.
										 - xma :Xilinx Media Accelerator
										 - qsv :Intel Quick Sync Video
										 - nv : Nvidia Video Codec SDK
										 - nilogan: Netint VPU

										You can use multiple modules by separating them with commas.
										For example, if you want to use xma and nv, you can set it as follows.

										<Modules>[ModuleName]:[DeviceId],[ModuleName]:[DeviceId],...</Modules>
										<Modules>xma:0,nv:0</Modules>
									-->
									<!-- <Modules>nv</Modules> -->
							</Decoder>
							<Encoder>
									<Enable>false</Enable>
									<!-- <Modules>nv:0</Modules> -->
							</Encoder>
						</HWAccels>

						<OutputProfile>
							<Name>bypass_stream</Name>
							<OutputStreamName>${OriginStreamName}</OutputStreamName>
							<Encodes>
								<Image>
									<Codec>jpeg</Codec>
									<Framerate>1</Framerate>
									<Width>1280</Width>
									<Height>720</Height>
								</Image>
								<Video>
									<Name>bypass_video</Name>
									<Bypass>true</Bypass>
								</Video>
								<Audio>
									<Name>aac_audio</Name>
									<Codec>aac</Codec>
									<Bitrate>128000</Bitrate>
									<Samplerate>48000</Samplerate>
									<Channel>2</Channel>
									<BypassIfMatch>
										<Codec>eq</Codec>
									</BypassIfMatch>
								</Audio>								
								<Audio>
									<Name>opus_audio</Name>
									<Codec>opus</Codec>
									<Bitrate>128000</Bitrate>
									<Samplerate>48000</Samplerate>
									<Channel>2</Channel>
									<BypassIfMatch>
										<Codec>eq</Codec>
									</BypassIfMatch>									
								</Audio>
							</Encodes>
						</OutputProfile>						
					</OutputProfiles>
					<Providers>
						<OVT />
						<WebRTC>
							<Timeout>30000</Timeout>
							<CrossDomains>
								<Url>*</Url>
							</CrossDomains>
						</WebRTC>
						<RTMP />
						<SRT />
						<RTSPPull />
						<Schedule>
							<MediaRootDir>/opt/ovenmediaengine/media</MediaRootDir>
							<ScheduleFilesDir>/opt/ovenmediaengine/media</ScheduleFilesDir>
						</Schedule>
						<!-- <MPEGTS>
							<StreamMap>
									<- Set the stream name of the client connected to the port to "stream_${Port}"
									For example, if a client connets to port 4000, OME creates a "stream_4000" stream ->
									<Stream>
										<Name>stream_${Port}</Name>
										<Port>4000,4001-4004</Port>
									</Stream>
									<Stream>
										<Name>stream_4005</Name>
										<Port>4005</Port>
									</Stream>
								<Stream>
									<Name>stream_${Port}</Name>
									<Port>${env:OME_MPEGTS_PROV_PORT:4000-4005/udp}</Port>
								</Stream>
							</StreamMap>
						</MPEGTS> -->
					</Providers>
					<Publishers>
						<AppWorkerCount>1</AppWorkerCount>
						<StreamWorkerCount>8</StreamWorkerCount>
						<OVT />
						<FILE>
							<RootPath>/mnt/videos</RootPath>
							<FilePath>/${VirtualHost}/${Application}/${Stream}/${StartTime:YYYYMMDDhhmmss}_${EndTime:YYYYMMDDhhmmss}.ts</FilePath>
							<InfoPath>/${VirtualHost}/${Application}/${Stream}.xml</InfoPath>
						</FILE>
						<WebRTC>
							<Timeout>30000</Timeout>
							<Rtx>false</Rtx>
							<Ulpfec>false</Ulpfec>
							<JitterBuffer>false</JitterBuffer>
						</WebRTC>
						<!--RTMP PUSHER THIS IS NOT WORKING, DOUBLE CHECK-->
						<!--
						<RTMPPush>
						</RTMPPush>
						<LLHLS>
							<OriginMode>true</OriginMode>
							<CacheControl>
								<MasterPlaylistMaxAge>0</MasterPlaylistMaxAge>
								<ChunklistMaxAge>0</ChunklistMaxAge>
								<ChunklistWithDirectivesMaxAge>60</ChunklistWithDirectivesMaxAge>
								<SegmentMaxAge>-1</SegmentMaxAge>
								<PartialSegmentMaxAge>-1</PartialSegmentMaxAge>
							</CacheControl>
							<ChunkDuration>0.5</ChunkDuration>
							<PartHoldBack>1.5</PartHoldBack>
							<SegmentDuration>6</SegmentDuration>
							<SegmentCount>10</SegmentCount>
							<CrossDomains>
								<Url>*</Url>
							</CrossDomains>
						</LLHLS>
						-->
						<Thumbnail>
							<CrossDomains>
								<Url>*</Url>
							</CrossDomains>	
						</Thumbnail>
					</Publishers>
				</Application>
			</Applications>
		</VirtualHost>
	</VirtualHosts>
</Server>

Expected behavior

Till a build

Logs
Please upload the entire OvenMediaEngine.log. You may delete important personal information.

ome-1  | [2024-04-25 00:29:18.816] I [OvenMediaEngine:1] Config | config_manager.cpp:261  | Trying to load configurations... (origin_conf/Server.xml)
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:23   | OvenMediaEngine v0.16.5 ((From archive)) is started on [ome] (Linux x86_64 - 6.5.0-28-generic, #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2)
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:27   | With modules:
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:28   |   FFmpeg 5.0.1
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:29   |     Configuration: --prefix=/opt/ovenmediaengine --extra-cflags='-I/opt/ovenmediaengine/include ' --extra-ldflags='-L/opt/ovenmediaengine/lib -Wl,-rpath,/opt/ovenmediaengine/lib ' --extra-libs=-ldl --disable-everything --disable-programs --disable-avdevice --disable-dwt --disable-lsp --disable-lzo --disable-faan --disable-pixelutils --enable-shared --enable-zlib --enable-libopus --enable-libvpx --enable-libfdk_aac --enable-libopenh264 --enable-openssl --enable-network --enable-libsrt --enable-dct --enable-rdft --disable-nvdec --disable-nvdec --disable-vaapi --disable-vdpau --disable-cuda-llvm --disable-cuvid --disable-ffnvcodec --enable-ffmpeg --enable-encoder='libvpx_vp8,libopus,libfdk_aac,libopenh264,mjpeg,png' --enable-decoder='aac,aac_latm,aac_fixed,mp3float,mp3,h264,hevc,opus,vp8' --enable-parser='aac,aac_latm,aac_fixed,h264,hevc,opus,vp8' --enable-protocol='tcp,udp,rtp,file,rtmp,tls,rtmps,libsrt' --enable-demuxer='rtsp,flv,live_flv,mp4,mp3' --enable-muxer='mp4,webm,mpegts,flv,mpjpeg' --enable-filter='asetnsamples,aresample,aformat,channelmap,channelsplit,scale,transpose,fps,settb,asettb,crop,format'
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:30   |     libavformat: 59.16.100
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:31   |     libavcodec: 59.18.100
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:32   |     libavutil: 57.17.100
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:33   |     libavfilter: 8.24.100
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:34   |     libswresample: 4.3.100
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:35   |     libswscale: 6.4.100
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:36   |   SRT: 1.5.2
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:37   |   SRTP: libsrtp2 2.4.2
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:38   |   OpenSSL: OpenSSL 3.0.7 1 Nov 2022
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:39   |     Configuration: compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:40   |   JsonCpp: 1.9.3
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:41   |   jemalloc: 5.3.0-0-g54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
ome-1  | [2024-04-25 00:29:18.820] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:73   | Server ID : ccbcab16-99a9-41ae-be23-28586d1e09bd
ome-1  | [2024-04-25 00:29:19.014] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:91   | Resolved public IP address (51.39.229.245) from stun server (stun.ovenmediaengine.com:13478)
ome-1  | [2024-04-25 00:29:19.014] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:109  | This host supports IPv4 and IPv6
ome-1  | [2024-04-25 00:29:19.017] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:126  | Trying to create MediaRouter...
ome-1  | [2024-04-25 00:29:19.017] I [OvenMediaEngine:1] MediaRouter | mediarouter.cpp:40   | Mediarouter has been started.
ome-1  | [2024-04-25 00:29:19.017] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:129  | Trying to create WebRTC Publisher...
ome-1  | [2024-04-25 00:29:19.017] I [OvenMediaEngine:1] Signalling.P2P | rtc_p2p_manager.cpp:27   | P2P is disabled in the configuration
ome-1  | [2024-04-25 00:29:19.018] W [OvenMediaEngine:1] HTTP.Server | http_server_manager.cpp:212  | Invalid address: ::, port: 3333 (HTTP) - [SocketAddress] Could not resolve name: "::" (-9)
ome-1  | [2024-04-25 00:29:19.018] E [OvenMediaEngine:1] HTTP.Server | http_server_manager.cpp:281  | Could not create HTTP Server for WebRTC Publisher
ome-1  | [2024-04-25 00:29:19.018] E [OvenMediaEngine:1] WebRTC Publisher | webrtc_publisher.cpp:115  | An error occurred while initialize WebRTC Publisher. Stopping RtcSignallingServer...
ome-1  | [2024-04-25 00:29:19.018] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:208  | Trying to release MediaRouter...
ome-1  | [2024-04-25 00:29:19.018] I [OvenMediaEngine:1] MediaRouter | mediarouter.cpp:49   | Mediarouter has been stopped.
ome-1  | [2024-04-25 00:29:19.018] E [OvenMediaEngine:1] OvenMediaEngine | main.cpp:129  | Failed to initialize WebRTC Publisher
ome-1  | [2024-04-25 00:29:19.018] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:334  | Uninitializing TCP socket pool...
ome-1  | [2024-04-25 00:29:19.118] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:336  | Uninitializing UDP socket pool...
ome-1  | [2024-04-25 00:29:19.122] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:339  | OvenMediaEngine will be terminated

Server (please complete the following information):

  • Docker build on both 0.16.5 and current master.
  • Docker compose for deployment.
  • prerequisites are same as current master.

Additional context
On a previous exact build it was working fine, on version 0.16.5. I'm wondering if one of the prerequisites changed enough on rebuild to create this? (I'm thinking of a similar situation to this: #1241)

@cesarandreslopez
Although ov::ipv6::internal::CheckIPv6Support() determined that IPv6 was enabled, it subsequently failed with EAI_ADDRFAMILY returned from the getaddrinfo() call.
Could you please share the IPv6 configuration in Docker to reproduce this issue?

Thank you @dimiden . We've deactivated IP6 altogether and clarified the relevant OME_HOST_IP variable to be specific against the docker host IP, and that allowed us to deactivate IPv6 altogether to get it to work. Previously, it would not work without IPv6 (specifically on edge - origin) , and based on this thread: #1587 (reply in thread), we had to turn on binding to :: to get it to work, but then, as mentioned above, :: stopped binding altogether on port 3333 after a docker upgrade.

We could trace the lack of binding on IPv6 due the new version of docker not having IPV6 configured after upgrade on it's daemon.json.

The above is not a problem for us anymore, but let me know if there is any information that we could provide that might be of your use. For now, I'm, closing the ticket.

O