srs/trunk/src/app
Winlin cff5064d0b HLS: Fix on_hls and hls_dispose critical zone issue. v5.0.174 v6.0.69 (#3781)
on_hls and hls_dispose are two coroutines, with potential race
conditions. That is, during on_hls, if the API Server being accessed is
slower, it will switch to the hls_dispose coroutine to start cleaning
up. However, when the API Server is processing the slice, a situation
may occur where the slice does not exist, resulting in the following
log:

```
[2023-08-22 12:03:20.309][WARN][40][x5l48q7b][11] ignore task failed code=4005(HttpStatus)(Invalid HTTP status code) : callback on_hls http://localhost:2024/terraform/v1/hooks/srs/hls : http: post http://localhost:2024/terraform/v1/hooks/srs/hls with {"server_id":"vid-5d7dxn8","service_id":"cu153o7g","action":"on_hls","client_id":"x5l48q7b","ip":"172.17.0.1","vhost":"__defaultVhost__","app":"live","tcUrl":"srt://172.17.0.2/live","stream":"stream-44572-2739617660809856576","param":"secret=1ed8e0ffbc53439c8fc8da30ab8c19f0","duration":4.57,"cwd":"/usr/local/srs-stack/platform","file":"./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts","url":"live/stream-44572-2739617660809856576-1.ts","m3u8":"./objs/nginx/html/live/stream-44572-2739617660809856576.m3u8","m3u8_url":"live/stream-44572-2739617660809856576.m3u8","seq_no":1,"stream_url":"/live/stream-44572-2739617660809856576","stream_id":"vid-0n9zoz3"}, status=500, res=invalid ts file ./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts: stat ./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts: no such file or directory
thread [40][x5l48q7b]: call() [./src/app/srs_app_hls.cpp:122][errno=11]
thread [40][x5l48q7b]: on_hls() [./src/app/srs_app_http_hooks.cpp:401][errno=11]
thread [40][x5l48q7b]: do_post() [./src/app/srs_app_http_hooks.cpp:638][errno=11]

[error] 2023/08/22 12:03:20.076984 [52][1001] Serve /terraform/v1/hooks/srs/hls failed, err is stat ./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts: no such file or directory
invalid ts file ./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts
main.handleOnHls.func1.1
	/g/platform/srs-hooks.go:684
main.handleOnHls.func1
	/g/platform/srs-hooks.go:720
net/http.HandlerFunc.ServeHTTP
	/usr/local/go/src/net/http/server.go:2084
net/http.(*ServeMux).ServeHTTP
	/usr/local/go/src/net/http/server.go:2462
net/http.serverHandler.ServeHTTP
	/usr/local/go/src/net/http/server.go:2916
net/http.(*conn).serve
	/usr/local/go/src/net/http/server.go:1966
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1571
```

Similarly, when stopping the stream, on_hls will also be called to
handle the last slice. If the API Server is slower at this time, it will
enter hls_dispose and call unpublish repeatedly. Since the previous
unpublish is still blocked in on_hls, the following interference log
will appear:

```
[2023-08-22 12:03:18.748][INFO][40][6498088c] hls cycle to dispose hls /live/stream-44572-2739617660809856576, timeout=10000000ms
[2023-08-22 12:03:18.752][WARN][40][6498088c][115] flush audio ignored, for segment is not open.
[2023-08-22 12:03:18.752][WARN][40][6498088c][115] ignore the segment close, for segment is not open.
```

Although this log will not cause problems, it can interfere with
judgment.

The solution is to add an 'unpublishing' status. If it is in the
'unpublishing' status, then do not clean up the slices.

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
2023-08-28 11:41:08 +08:00
..
srs_app_async_call.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_async_call.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_caster_flv.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_caster_flv.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_config.cpp Support include empty config file. v5.0.173 v6.0.68 (#3768) 2023-08-28 10:53:27 +08:00
srs_app_config.hpp WebRTC: Support config the bitrate of transcoding AAC to Opus. v5.0.167, v6.0.60 (#3515) 2023-07-18 11:09:50 +08:00
srs_app_conn.cpp SSL: Fix SSL_get_error get the error of other coroutine. v5.0.155, v6.0.46 (#3513) 2023-05-29 13:00:41 +08:00
srs_app_conn.hpp SSL: Fix SSL_get_error get the error of other coroutine. v5.0.155, v6.0.46 (#3513) 2023-05-29 13:00:41 +08:00
srs_app_coworkers.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_coworkers.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_dash.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_dash.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_dvr.cpp BugFix: Resolve the problem of srs_error_t memory leak. v5.0.163, v6.0.57 (#3605) 2023-07-01 18:46:59 +08:00
srs_app_dvr.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_edge.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_edge.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_empty.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_empty.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_encoder.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_encoder.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_ffmpeg.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_ffmpeg.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_forward.cpp SRS5: Config: Support better env name for prefixed with srs (#3370) 2023-01-11 10:57:24 +08:00
srs_app_forward.hpp SRS5: Config: Support better env name for prefixed with srs (#3370) 2023-01-11 10:57:24 +08:00
srs_app_fragment.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_fragment.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_gb28181.cpp GB: Correct the range of HEVC keyframe error. v6.0.49 (#3570) 2023-06-12 16:48:22 +08:00
srs_app_gb28181.hpp GB: Support H.265 for GB28181 (#3408) 2023-02-14 14:28:41 +08:00
srs_app_hds.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_hds.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_heartbeat.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_heartbeat.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_hls.cpp HLS: Fix on_hls and hls_dispose critical zone issue. v5.0.174 v6.0.69 (#3781) 2023-08-28 11:41:08 +08:00
srs_app_hls.hpp HLS: Fix on_hls and hls_dispose critical zone issue. v5.0.174 v6.0.69 (#3781) 2023-08-28 11:41:08 +08:00
srs_app_hourglass.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_hourglass.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_http_api.cpp API: Support server/pid/service label for exporter and api. (#3385) 2023-01-18 07:25:44 +08:00
srs_app_http_api.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_http_client.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_http_client.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_http_conn.cpp API: Support HTTP basic authentication for API. v6.0.4, v5.0.152 (#3458) 2023-04-01 12:45:29 +08:00
srs_app_http_conn.hpp API: Support HTTP basic authentication for API. v6.0.4, v5.0.152 (#3458) 2023-04-01 12:45:29 +08:00
srs_app_http_hooks.cpp API: Add service_id for http_hooks, which identify the process, v6.0.28, v5.0.142 (#3424) 2023-02-25 08:42:19 +08:00
srs_app_http_hooks.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_http_static.cpp HLS: support kick-off hls client (#3371) 2023-01-29 11:40:44 +08:00
srs_app_http_static.hpp HLS: support kick-off hls client (#3371) 2023-01-29 11:40:44 +08:00
srs_app_http_stream.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_http_stream.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_hybrid.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_hybrid.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_ingest.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_ingest.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_latest_version.cpp Support helm to optimize the deployment procedure of a SRS cluster. v6.0.64 (#3611) 2023-07-27 09:07:31 +08:00
srs_app_latest_version.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_listener.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_listener.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_log.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_log.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_mpegts_udp.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_mpegts_udp.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_ng_exec.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_ng_exec.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_pithy_print.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_pithy_print.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_process.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_process.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_recv_thread.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_recv_thread.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_refer.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_refer.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_reload.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_reload.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_rtc_api.cpp WHIP: Improve WHIP deletion by token verification. v5.0.164, v6.0.58 (#3595) 2023-07-01 19:08:21 +08:00
srs_app_rtc_api.hpp WHIP: Improve HTTP DELETE for notifying server unpublish event (#3539) 2023-05-12 15:23:04 +08:00
srs_app_rtc_codec.cpp SRS5: FFmpeg: Support build with FFmpeg native opus. v5.0.131 (#3140) 2023-01-06 17:46:37 +08:00
srs_app_rtc_codec.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_rtc_conn.cpp WHIP: Improve WHIP deletion by token verification. v5.0.164, v6.0.58 (#3595) 2023-07-01 19:08:21 +08:00
srs_app_rtc_conn.hpp WHIP: Improve WHIP deletion by token verification. v5.0.164, v6.0.58 (#3595) 2023-07-01 19:08:21 +08:00
srs_app_rtc_dtls.cpp DTLS: Use bio callback to get fragment packet. v5.0.156, v6.0.47 (#3565) 2023-06-05 10:45:14 +08:00
srs_app_rtc_dtls.hpp DTLS: Use bio callback to get fragment packet. v5.0.156, v6.0.47 (#3565) 2023-06-05 10:45:14 +08:00
srs_app_rtc_network.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_rtc_network.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_rtc_queue.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_rtc_queue.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_rtc_sdp.cpp WHIP: Add OBS support, ensuring compatibility with a unique SDP. v5.0.158, v6.0.51 (#3581) 2023-06-15 12:11:31 +08:00
srs_app_rtc_sdp.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_rtc_server.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_rtc_server.hpp WHIP: Improve WHIP deletion by token verification. v5.0.164, v6.0.58 (#3595) 2023-07-01 19:08:21 +08:00
srs_app_rtc_source.cpp WebRTC: Support config the bitrate of transcoding AAC to Opus. v5.0.167, v6.0.60 (#3515) 2023-07-18 11:09:50 +08:00
srs_app_rtc_source.hpp Support composited bridges for 1:N protocols converting. v6.0.41 (#3392) 2023-04-01 21:34:59 +08:00
srs_app_rtmp_conn.cpp Support composited bridges for 1:N protocols converting. v6.0.41 (#3392) 2023-04-01 21:34:59 +08:00
srs_app_rtmp_conn.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_security.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_security.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_server.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_server.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_source.cpp HLS: Support reload HLS asynchronously. v5.0.172 v6.0.67 (#3782) 2023-08-25 09:46:21 +08:00
srs_app_source.hpp HLS: Support reload HLS asynchronously. v5.0.172 v6.0.67 (#3782) 2023-08-25 09:46:21 +08:00
srs_app_srt_conn.cpp Support composited bridges for 1:N protocols converting. v6.0.41 (#3392) 2023-04-01 21:34:59 +08:00
srs_app_srt_conn.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_srt_listener.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_srt_listener.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_srt_server.cpp SRT: Upgrade libsrt from 1.4.1 to 1.5.1. v6.0.12 (#3362) 2023-01-04 19:56:33 +08:00
srs_app_srt_server.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_srt_source.cpp Support composited bridges for 1:N protocols converting. v6.0.41 (#3392) 2023-04-01 21:34:59 +08:00
srs_app_srt_source.hpp Support composited bridges for 1:N protocols converting. v6.0.41 (#3392) 2023-04-01 21:34:59 +08:00
srs_app_srt_utility.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_srt_utility.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_st.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_st.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_statistic.cpp Support composited bridges for 1:N protocols converting. v6.0.41 (#3392) 2023-04-01 21:34:59 +08:00
srs_app_statistic.hpp API: Support server/pid/service label for exporter and api. (#3385) 2023-01-18 07:25:44 +08:00
srs_app_stream_bridge.cpp Support composited bridges for 1:N protocols converting. v6.0.41 (#3392) 2023-04-01 21:34:59 +08:00
srs_app_stream_bridge.hpp Support composited bridges for 1:N protocols converting. v6.0.41 (#3392) 2023-04-01 21:34:59 +08:00
srs_app_tencentcloud.cpp Replace sprintf with snprintf to eliminate compile warnings. v6.0.45 (#3534) 2023-05-14 13:04:21 +08:00
srs_app_tencentcloud.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_threads.cpp Incorrect use of two "int i" instances. (#3759) 2023-08-09 19:54:26 +08:00
srs_app_threads.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_utility.cpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_utility.hpp SRS5: Update license date to 2023. v5.0.123 2023-01-01 08:56:20 +08:00
srs_app_uuid.cpp For #2532: Windows: Support CYGWIN64 for SRS (#3255) 2022-11-20 12:29:57 +08:00
srs_app_uuid.hpp API: Use libuuid to generate uuid. v5.0.9 2021-08-06 22:02:46 +08:00