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

[BUG] 点播端口分配异常 #3542

Closed
ananix opened this issue May 16, 2024 · 4 comments
Closed

[BUG] 点播端口分配异常 #3542

ananix opened this issue May 16, 2024 · 4 comments
Labels

Comments

@ananix
Copy link

ananix commented May 16, 2024

现象描述

接入国标NVR设备,NVR下有很多通道视频,使用TCP-PASSIVE模式取流时,会出现端口逐渐不够用,无法分配新的端口,导致视频无法正常播放.

如何复现?

1. 设置拉流模式为TCP-PASSIVE
2. 设置[rtp_proxy] port_range=60000-61000
3. web端使用wvp-GB28181-Pro页面通过ws播放,客户端通过RTSP点播视频播放
4. 一段时间后,视频无法正常播放,提示“点播端口分配异常”
5. 查看日志也提示“Listen on :: 60666 failed: address already in use”
6. 通过ss -tuln,netstat -nplt等命令查看出端口占用情况,也发现60000-61000端口被ZM占用,
7. 开了1000个端口,同时播放的视频不可能有这么多,为什么会端口不够用呢

相关日志或截图

{
"code" : -400,
"msg" : "Listen on :: 60666 failed: address already in use"
}

展开查看详细日志

MediaServer日志:
2024-05-16 08:00:00.296 D [MediaServer] [3659683-event poller 11] WebApi.cpp:261 http api debug |
request:
POST /index/api/getRtpInfo
header:
Accept-Encoding : gzip
Connection : Keep-Alive
Content-Length : 91
Content-Type : application/x-www-form-urlencoded
Host : 10.30.0.246:8086
User-Agent : okhttp/4.10.0
content:
secret=JgH9fyq17zwdCyjurcmh5sXRY17w1JM1&stream_id=41018200111187000069_41018200111327000072
response:
{
"code" : 0,
"exist" : false
}

2024-05-16 08:00:00.296 I [MediaServer] [3659683-event poller 11] Rtsp.cpp:413 getPortPair | got port from pool:60666-60667
2024-05-16 08:00:00.297 W [MediaServer] [3659683-event poller 11] sockutil.cpp:428 bind_sock6 | Bind socket failed: address already in use
2024-05-16 08:00:00.297 I [MediaServer] [3659683-event poller 11] Rtsp.cpp:422 operator() | return port to pool:60666-60667
2024-05-16 08:00:00.297 D [MediaServer] [3659683-event poller 11] WebApi.cpp:261 http api debug |
request:
POST /index/api/openRtpServer
header:
Accept-Encoding : gzip
Connection : Keep-Alive
Content-Length : 136
Content-Type : application/x-www-form-urlencoded
Host : 10.30.0.246:8086
User-Agent : okhttp/4.10.0
content:
secret=JgH9fyq17zwdCyjurcmh5sXRY17w1JM1&re_use_port=1&stream_id=41018200111187000069_41018200111327000072&port=0&only_audio=0&tcp_mode=1
response:
{
"code" : -400,
"msg" : "Listen on :: 60666 failed: address already in use"
}

其他日志:
2024-05-16 09:05:00.078 [http-nio-8082-exec-760] INFO c.g.iot.vmp.vmanager.gb28181.play.PlayController:86 - [开始点播] deviceId:41010300111187000124, channelId:41010300111327000130,
2024-05-16 09:05:00.083 [http-nio-8082-exec-760] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:470 - [点播开始] deviceId: 41010300111187000124, channelId: 41010300111327000130,码流类型:null, 收流端口: -1, 码流:41010300111187000124_41010300111327000130, 收流模式:TCP-PASSIVE, SSRC: 0000002917, SSRC校验:false
2024-05-16 09:05:00.083 [http-nio-8082-exec-764] INFO c.g.iot.vmp.vmanager.gb28181.play.PlayController:86 - [开始点播] deviceId:41018200111187000069, channelId:41018200111327000072,
2024-05-16 09:05:00.083 [http-nio-8082-exec-760] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:475 - [点播端口分配异常],deviceId=41010300111187000124,channelId=41010300111327000130,ssrcInfo=com.genersoft.iot.vmp.service.bean.SSRCInfo@56db172f
2024-05-16 09:05:00.088 [http-nio-8082-exec-764] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:470 - [点播开始] deviceId: 41018200111187000069, channelId: 41018200111327000072,码流类型:null, 收流端口: -1, 码流:41018200111187000069_41018200111327000072, 收流模式:TCP-PASSIVE, SSRC: 0000009024, SSRC校验:false
2024-05-16 09:05:00.088 [http-nio-8082-exec-764] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:475 - [点播端口分配异常],deviceId=41018200111187000069,channelId=41018200111327000072,ssrcInfo=com.genersoft.iot.vmp.service.bean.SSRCInfo@7bb7946d
2024-05-16 09:05:00.093 [http-nio-8082-exec-771] INFO c.g.iot.vmp.vmanager.gb28181.play.PlayController:86 - [开始点播] deviceId:41010300111187000124, channelId:41010300111327000130,
2024-05-16 09:05:00.096 [http-nio-8082-exec-761] INFO c.g.iot.vmp.vmanager.gb28181.play.PlayController:86 - [开始点播] deviceId:41018200111187000069, channelId:41018200111327000072,
2024-05-16 09:05:00.097 [http-nio-8082-exec-771] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:470 - [点播开始] deviceId: 41010300111187000124, channelId: 41010300111327000130,码流类型:null, 收流端口: -1, 码流:41010300111187000124_41010300111327000130, 收流模式:TCP-PASSIVE, SSRC: 0000007464, SSRC校验:false
2024-05-16 09:05:00.097 [http-nio-8082-exec-771] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:475 - [点播端口分配异常],deviceId=41010300111187000124,channelId=41010300111327000130,ssrcInfo=com.genersoft.iot.vmp.service.bean.SSRCInfo@5c0e4d63
2024-05-16 09:05:00.101 [http-nio-8082-exec-761] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:470 - [点播开始] deviceId: 41018200111187000069, channelId: 41018200111327000072,码流类型:null, 收流端口: -1, 码流:41018200111187000069_41018200111327000072, 收流模式:TCP-PASSIVE, SSRC: 0000003747, SSRC校验:false
2024-05-16 09:05:00.101 [http-nio-8082-exec-761] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:475 - [点播端口分配异常],deviceId=41018200111187000069,channelId=41018200111327000072,ssrcInfo=com.genersoft.iot.vmp.service.bean.SSRCInfo@144ba9c0
2024-05-16 09:05:00.107 [http-nio-8082-exec-765] INFO c.g.iot.vmp.vmanager.gb28181.play.PlayController:86 - [开始点播] deviceId:41010300111187000124, channelId:41010300111327000130,
2024-05-16 09:05:00.111 [http-nio-8082-exec-748] INFO c.g.iot.vmp.vmanager.gb28181.play.PlayController:86 - [开始点播] deviceId:41018200111187000069, channelId:41018200111327000072,
2024-05-16 09:05:00.112 [http-nio-8082-exec-765] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:470 - [点播开始] deviceId: 41010300111187000124, channelId: 41010300111327000130,码流类型:null, 收流端口: -1, 码流:41010300111187000124_41010300111327000130, 收流模式:TCP-PASSIVE, SSRC: 0000005701, SSRC校验:false
2024-05-16 09:05:00.112 [http-nio-8082-exec-765] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:475 - [点播端口分配异常],deviceId=41010300111187000124,channelId=41010300111327000130,ssrcInfo=com.genersoft.iot.vmp.service.bean.SSRCInfo@7f2d7ab
2024-05-16 09:05:00.115 [wvp-2] INFO c.g.i.v.g.t.e.r.i.m.n.c.AlarmNotifyMessageHandler:89 - [收到报警通知]设备:41017200111187000026
2024-05-16 09:05:00.115 [wvp-2] INFO c.g.i.v.g.t.e.r.i.m.n.c.AlarmNotifyMessageHandler:100 - [处理报警通知]待处理数量:1
2024-05-16 09:05:00.115 [wvp-2] INFO c.g.i.v.g.t.e.r.i.m.n.c.AlarmNotifyMessageHandler:172 - [收到报警通知]内容:{"alarmDescription":"","alarmMethod":"6","alarmPriority":"4","alarmTime":"2024-05-16 09:04:58","channelId":"41017200111187000026","createTime":"2024-05-16 09:05:00","deviceId":"41017200111187000026","latitude":0.0,"longitude":0.0}
2024-05-16 09:05:00.116 [http-nio-8082-exec-748] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:470 - [点播开始] deviceId: 41018200111187000069, channelId: 41018200111327000072,码流类型:null, 收流端口: -1, 码流:41018200111187000069_41018200111327000072, 收流模式:TCP-PASSIVE, SSRC: 0000006656, SSRC校验:false
2024-05-16 09:05:00.117 [http-nio-8082-exec-748] INFO com.genersoft.iot.vmp.service.impl.PlayServiceImpl:475 - [点播端口分配异常],deviceId=41018200111187000069,channelId=41018200111327000072,ssrcInfo=com.genersoft.iot.vmp.service.bean.SSRCInfo@19272387

配置

port_range=60000-61000

展开查看详细配置
[multicast]
addrMax=239.255.255.255
addrMin=239.0.0.0
udpTTL=64

[protocol]
add_mute_audio=1
auto_close=0
continue_push_ms=3000
enable_audio=1
enable_fmp4=1
enable_hls=1
enable_hls_fmp4=0
enable_mp4=0
enable_rtmp=1
enable_rtsp=1
enable_ts=1
fmp4_demand=0
hls_demand=1
hls_save_path=./www
modify_stamp=2
mp4_as_player=0
mp4_max_second=3600
mp4_save_path=./www
paced_sender_ms=0
; auto-generated by mINI class {

[api]
apiDebug=1
defaultSnap=./www/logo.png
downloadRoot=./www
secret=JgH9fyq17zwdCyjurcmh5sXRY17w1JM1
snapRoot=./www/snap/

[cluster]
origin_url=
retry_count=3
timeout_sec=15

[ffmpeg]
bin=/usr/bin/ffmpeg
cmd=%s -re -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s
log=./ffmpeg/ffmpeg.log
restart_sec=0
snap=%s -rtsp_transport tcp -i %s -y -f mjpeg -frames:v 1 %s

[general]
check_nvidia_dev=1
enableVhost=0
enable_ffmpeg_log=0
flowThreshold=1024
maxStreamWaitMS=5000
resetWhenRePlay=1
streamNoneReaderDelayMS=5000
unready_frame_cache=100

[hls]
broadcastRecordTs=0
deleteDelaySec=10
fastRegister=0
fileBufSize=65536
segDelay=0
segDur=2
segKeep=0
segNum=3
segRetain=5

[hook]
alive_interval=10.0
enable=1
on_flow_report=
on_http_access=
on_play=http://10.30.0.222:8082/index/hook/on_play
on_publish=http://10.30.0.222:8082/index/hook/on_publish
on_record_mp4=http://10.30.0.222:8082/index/hook/on_record_mp4
on_record_ts=
on_rtp_server_timeout=http://10.30.0.222:8082/index/hook/on_rtp_server_timeout
on_rtsp_auth=
on_rtsp_realm=
on_send_rtp_stopped=http://10.30.0.222:8082/index/hook/on_send_rtp_stopped
on_server_exited=
on_server_keepalive=http://10.30.0.222:8082/index/hook/on_server_keepalive
on_server_started=http://10.30.0.222:8082/index/hook/on_server_started
on_shell_login=
on_stream_changed=http://10.30.0.222:8082/index/hook/on_stream_changed
on_stream_none_reader=http://10.30.0.222:8082/index/hook/on_stream_none_reader
on_stream_not_found=http://10.30.0.222:8082/index/hook/on_stream_not_found
retry=1
retry_delay=3.0
stream_changed_schemas=rtsp/rtmp/fmp4/ts/hls/hls.fmp4
timeoutSec=30

[http]
allow_cross_domains=1
allow_ip_range=::1,127.0.0.1,172.16.0.0-172.31.255.255,192.168.0.0-192.168.255.255,10.0.0.0-10.255.255.255
charSet=utf-8
dirMenu=1
forbidCacheSuffix=
forwarded_ip_header=
keepAliveSecond=30
maxReqSize=40960
port=8086
rootPath=./www
sendBufSize=65536
sslport=443
virtualPath=

[multicast]
addrMax=239.255.255.255
addrMin=239.0.0.0
udpTTL=64

[protocol]
add_mute_audio=1
auto_close=0
continue_push_ms=3000
enable_audio=1
enable_fmp4=1
enable_hls=1
enable_hls_fmp4=0
enable_mp4=0
enable_rtmp=1
enable_rtsp=1
enable_ts=1
fmp4_demand=0
hls_demand=1
hls_save_path=./www
modify_stamp=2
mp4_as_player=0
mp4_max_second=3600
mp4_save_path=./www
paced_sender_ms=0
rtmp_demand=0
rtsp_demand=0
ts_demand=1

[record]
appName=record
fastStart=0
fileBufSize=65536
fileRepeat=0
sampleMS=500

[rtc]
externIP=
max_bitrate=0
min_bitrate=0
port=8000
preferredCodecA=PCMU,PCMA,opus,mpeg4-generic
preferredCodecV=H264,H265,AV1,VP9,VP8
rembBitRate=0
start_bitrate=0
tcpPort=8000
timeoutSec=15

[rtmp]
directProxy=1
enhanced=0
handshakeSecond=15
keepAliveSecond=15
port=1935
sslport=0

[rtp]
audioMtuSize=600
h264_stap_a=1
lowLatency=0
rtpMaxSize=10
videoMtuSize=1400

[rtp_proxy]
dumpDir=
gop_cache=1
h264_pt=98
h265_pt=99
opus_pt=100
port=10000
port_range=60000-61000
ps_pt=96
rtp_g711_dur_ms=100
timeoutSec=15
udp_recv_socket_buffer=4194304

[rtsp]
authBasic=0
directProxy=1
handshakeSecond=15
keepAliveSecond=15
lowLatency=0
port=554
rtpTransportType=-1
sslport=0

[shell]
maxReqSize=1024
port=0

[srt]
latencyMul=4
pktBufSize=8192
port=9000
timeoutSec=5

各种环境信息

  • 代码提交记录/git commit hash:fe61b572e0c95fff4261902d76cb3b8bcbcc2114
  • 操作系统及版本:Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-70-generic x86_64)
  • 硬件信息:16C32G
  • 其他需要补充的信息:
c16d36d72aea5e06836d249883c91cf 19198a22358b4faefa71ef9e00ab84e 1694225bcef3e37b4980e5bcf5c50b8
@ananix ananix added the bug label May 16, 2024
@xiongguangjie
Copy link
Member

端口被其他程序占用了吧,配置下 net.ipv4.ip_local_reserved_ports

@ananix
Copy link
Author

ananix commented May 16, 2024

端口被其他程序占用了吧,配置下net.ipv4.ip_local_reserved_ports

按照上面最后一张图片看,端口就是被3659683/MediaServ程序占用。
image

@xiongguangjie
Copy link
Member

xiongguangjie commented May 16, 2024

端口被其他程序占用了吧,配置下net.ipv4.ip_local_reserved_ports

按照上面最后一张图片看,端口就是被3659683/MediaServ程序占用。 image

60666没见到被谁占用了,如果是被MediaServer 占用了,这个是wvp的端口管理有问题,你升级下wvp或者给它提issue

@xia-chu
Copy link
Member

xia-chu commented May 17, 2024

更新下zlm吧 这个问题在 50f65c4 修复了

@xia-chu xia-chu closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants