Stream already exists or busy
Closed this issue · 3 comments
Stream is not published but does not start
Sep 07 19:45:36 Haifa srs[1202882]: [2025-09-07 19:45:36.914][INFO][1202882][334f2079] RTMP client ip=93.100.133.11:5103, fd=150
Sep 07 19:45:36 Haifa srs[1202882]: [2025-09-07 19:45:36.917][INFO][1202882][334f2079] simple handshake success.
Sep 07 19:45:36 Haifa srs[1202882]: [2025-09-07 19:45:36.918][INFO][1202882][334f2079] connect app, tcUrl=rtmp://exampla.com, pageUrl=, swfUrl=rtmp://exampla.com, schema=rtmp, vhost=exampla.com, port=1935, app=__defaultApp__, args=null
Sep 07 19:45:36 Haifa srs[1202882]: [2025-09-07 19:45:36.918][INFO][1202882][334f2079] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=4096, out.chunk=128
Sep 07 19:45:36 Haifa srs[1202882]: [2025-09-07 19:45:36.972][INFO][1202882][334f2079] client identified, type=fmle-publish, vhost=exampla.com, app=__defaultApp__, stream=radiox, param=?key=yb8o7j1k4n85h0xsqpht, duration=0ms
Sep 07 19:45:36 Haifa srs[1202882]: [2025-09-07 19:45:36.972][INFO][1202882][334f2079] connected stream, tcUrl=rtmp://exampla.com, pageUrl=, swfUrl=rtmp://exampla.com, schema=rtmp, vhost=__defaultVhost__, port=1935, app=__defaultApp__, stream=radiox, param=?key=yb8o7j1k4n85h0xsqpht, args=null
Sep 07 19:45:36 Haifa srs[1202882]: [2025-09-07 19:45:36.972][INFO][1202882][334f2079] source url=/__defaultApp__/radiox, ip=93.100.133.11, cache=0/2500, is_edge=0, source_id=431ziim6/jc97qf34
Sep 07 19:45:37 Haifa srs[1202882]: [2025-09-07 19:45:37.027][INFO][1202882][334f2079] https: connected to https://exampla.com:443, cost=4ms
Sep 07 19:45:40 Haifa srs[1202882]: [2025-09-07 19:45:40.155][INFO][1202882][334f2079] http: on_publish ok, client_id=334f2079, url=https://exampla.com/hook/srs/publish, request={"server_id":"srs","service_id":"41168m39","action":"on_publish","client_id":"334f2079","ip":"93.100.133.11","vhost":"__defaultVhost__","app":"__defaultApp__","tcUrl":"rtmp://exampla.com","stream":"radiox","param":"?key=yb8o7j1k4n85h0xsqpht","stream_url":"/__defaultApp__/radiox","stream_id":"vid-5xvl6n5"}, response=0
Sep 07 19:45:40 Haifa srs[1202882]: [2025-09-07 19:45:40.156][ERROR][1202882][334f2079][0] serve error code=1028(StreamBusy)(Stream already exists or busy) : service cycle : rtmp: stream service : rtmp: stream /__defaultApp__/radiox is busy
Sep 07 19:45:40 Haifa srs[1202882]: thread [1202882][334f2079]: do_cycle() [./src/app/srs_app_rtmp_conn.cpp:263][errno=0]
Sep 07 19:45:40 Haifa srs[1202882]: thread [1202882][334f2079]: service_cycle() [./src/app/srs_app_rtmp_conn.cpp:457][errno=0]
Sep 07 19:45:40 Haifa srs[1202882]: thread [1202882][334f2079]: acquire_publish() [./src/app/srs_app_rtmp_conn.cpp:1078][errno=0]
Sep 07 19:49:10 Haifa srs[1202882]: [2025-09-07 19:49:10.284][INFO][1202882][9h18tn50] HTTP #0 127.0.0.1:54122 DELETE http://exampla.com/api/v1/clients/334f2079, content-length=-1
curl -s "http://127.0.0.1:1985/api/v1/streams/?count=1000" | jq '.streams | map(select(.name=="radiox")) '
[
{
"id": "vid-7037as3",
"name": "radiox",
"vhost": "vid-l95601k",
"app": "__defaultApp__",
"tcUrl": "rtmp://exampla.ru",
"url": "/__defaultApp__/radiox",
"live_ms": 1757267364434,
"clients": 2,
"frames": 169996,
"send_bytes": 851394859,
"recv_bytes": 985964755,
"kbps": {
"recv_30s": 4285,
"send_30s": 230
},
"publish": {
"active": false
},
"video": {
"codec": "H264",
"profile": "High",
"level": "Other",
"width": 1280,
"height": 720
},
"audio": {
"codec": "AAC",
"sample_rate": 44100,
"channel": 2,
"profile": "LC"
}
}
]
!!! UPDATE
Another case, the Stream is active, but does not play.
ffmpeg -i source.mkv -f -flv rtmp://example.com/app/stream1 -f -flv rtmp://example.com/app/stream2 -f -flv
rtmp://example.com/app/stream3
Origin
curl http://127.0.0.1:8081/__defaultApp__/stream1.flv
create consumer, active=0, queue_size=10000ms, jitter=3
Stream is detected as inactive!
On Edge
curl http://127.0.0.1:8081/__defaultApp__/stream1.flv
create consumer, active=1, queue_size=10000ms, jitter=3
FLV: write header audio=1, video=1, dinm=1, config=1/1/0
Active!
the other two streams are played on Origin and Edge
curl -s "http://127.0.0.1:1986/api/v1/streams/?count=100001" | jq '.streams | map(select(.name=="stream1"))'
[
{
"id": "vid-v311574",
"name": "stream1",
"vhost": "vid-3518c35",
"app": "__defaultApp__",
"tcUrl": "rtmp://example.com:1936/__defaultApp__",
"url": "/__defaultApp__/stream1",
"live_ms": 1757319916660,
"clients": 3,
"frames": 21102,
"send_bytes": 124348,
"recv_bytes": 98336,
"kbps": {
"recv_30s": 0,
"send_30s": 0
},
"publish": {
"active": true,
"cid": "69918o0u"
},
"video": {
"codec": "H264",
"profile": "High",
"level": "3",
"width": 720,
"height": 430
},
"audio": {
"codec": "AAC",
"sample_rate": 44100,
"channel": 2,
"profile": "LC"
}
}
]
The stream is active!
HLS is playing
also this same stream is playing on edge
also, the publish hook is executed BEFORE the activity check. You need to do the activity check first, and then run the hook.
Today I noticed that after the restart of the SRS (crash), some streams (which were launched first again) are not active on the origin, but are active on the edge