Closed progre closed 2 years ago
RTMP のチャンネルで配信後、終了した後で RTMP のリスナーが残り続けることがあります。これは PeerCastStation.exe を終了する以外の方法で中止する方法が見当たりません。
# rtmp://localhost:50026/live/livestream でチャンネルを作成 ❯ netstat -nao -p tcp ...中略 TCP 127.0.0.1:50026 0.0.0.0:0 LISTENING 33568 ...中略
OBS からのストリームを停止してから3秒以内に切断すると確実に発生します。
このケースは現象が発生しました。
RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:29:10 DEBUG - NetConnection command: FCUnpublish RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:29:10 DEBUG - NetConnection command: deleteStream RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:29:10 DEBUG - Stop requested by reason OffAir RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:29:10 DEBUG - closed RTMPSourceStream[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:29:10 DEBUG - Connection stopped by reason OffAir RTMPSourceStream[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:29:10 DEBUG - Cleaning up connection (closed by OffAir) OutputListener: 2022-04-13T21:29:12 INFO - Client connected [::1]:55436 ConnectionHandler: 2022-04-13T21:29:12 DEBUG - Output thread started ConnectionHandler: 2022-04-13T21:29:12 DEBUG - Output stream started 0 OwinHostOutputStream[[::1]:55436]: 2022-04-13T21:29:12 DEBUG - Starting YPConnectionPool: 2022-04-13T21:29:12 DEBUG - Stop announce channel 4d266da43326ad5c2bf2932f7a472b98 from p@ PeerCast: 2022-04-13T21:29:12 DEBUG - Channel Removed: 4d266da43326ad5c2bf2932f7a472b98 PCPYellowPageConnection[p@ (IPv6)]: 2022-04-13T21:29:12 DEBUG - Closing connection OwinHostOutputStream[[::1]:55436]: 2022-04-13T21:29:12 DEBUG - Finished PCPYellowPageConnection[p@ (IPv6)]: 2022-04-13T21:29:12 DEBUG - Connection closed RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:29:13 DEBUG - Listening on [::1]:50026 RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:29:13 DEBUG - Listening on 127.0.0.1:50026 OwinHostOutputStream[[::1]:55361]: 2022-04-13T21:29:17 DEBUG - Finished OutputListener: 2022-04-13T21:29:20 INFO - Client connected [::1]:55454 ConnectionHandler: 2022-04-13T21:29:20 DEBUG - Output thread started ConnectionHandler: 2022-04-13T21:29:23 DEBUG - No protocol handler matched OutputListener: 2022-04-13T21:29:25 INFO - Client connected [::1]:55469 ConnectionHandler: 2022-04-13T21:29:25 DEBUG - Output thread started ConnectionHandler: 2022-04-13T21:29:27 DEBUG - Output stream started 0 OwinHostOutputStream[[::1]:55469]: 2022-04-13T21:29:27 DEBUG - Starting OwinHostOutputStream[[::1]:55469]: 2022-04-13T21:29:37 DEBUG - Finished
このケースは現象が発生しませんでした。
RTMPSourceConnection に注目すると、Listen cancelled Stop requested by reason ConnectionError but already stopped Stop requested by reason UserShutdown が発行されています。
Listen cancelled
Stop requested by reason ConnectionError but already stopped
Stop requested by reason UserShutdown
RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:26:56 DEBUG - NetConnection command: FCUnpublish RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:26:56 DEBUG - NetConnection command: deleteStream RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:26:56 DEBUG - Stop requested by reason OffAir RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:26:56 DEBUG - closed RTMPSourceStream[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:26:56 DEBUG - Connection stopped by reason OffAir RTMPSourceStream[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:26:56 DEBUG - Cleaning up connection (closed by OffAir) RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:26:59 DEBUG - Listening on [::1]:50026 RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:26:59 DEBUG - Listening on 127.0.0.1:50026 OutputListener: 2022-04-13T21:27:02 INFO - Client connected [::1]:55125 ConnectionHandler: 2022-04-13T21:27:02 DEBUG - Output thread started ConnectionHandler: 2022-04-13T21:27:02 DEBUG - Output stream started 0 OwinHostOutputStream[[::1]:55125]: 2022-04-13T21:27:02 DEBUG - Starting RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:27:02 DEBUG - Listen cancelled RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:27:02 DEBUG - Stop requested by reason ConnectionError but already stopped RTMPSourceStream[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:27:02 DEBUG - Connection stopped by reason UserShutdown RTMPSourceConnection[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:27:02 DEBUG - Stop requested by reason UserShutdown RTMPSourceStream[rtmp://localhost:50026/live/livestream]: 2022-04-13T21:27:02 DEBUG - Cleaning up connection (closed by UserShutdown) PeerCast: 2022-04-13T21:27:02 DEBUG - Channel Removed: 4d266da43326ad5c2bf2932f7a472b98 YPConnectionPool: 2022-04-13T21:27:02 DEBUG - Stop announce channel 4d266da43326ad5c2bf2932f7a472b98 from p@ PCPYellowPageConnection[p@ (IPv6)]: 2022-04-13T21:27:02 DEBUG - Closing connection OwinHostOutputStream[[::1]:55125]: 2022-04-13T21:27:02 DEBUG - Finished PCPYellowPageConnection[p@ (IPv6)]: 2022-04-13T21:27:03 DEBUG - Connection closed
3.1.0 に含めてます。
問題と期待される動作
RTMP のチャンネルで配信後、終了した後で RTMP のリスナーが残り続けることがあります。これは PeerCastStation.exe を終了する以外の方法で中止する方法が見当たりません。
再現方法
OBS からのストリームを停止してから3秒以内に切断すると確実に発生します。
参考1: ストリーム停止から2秒後にチャンネル終了した場合のログ
このケースは現象が発生しました。
参考2: ストリーム停止から6秒後にチャンネル終了
このケースは現象が発生しませんでした。
RTMPSourceConnection に注目すると、
Listen cancelled
Stop requested by reason ConnectionError but already stopped
Stop requested by reason UserShutdown
が発行されています。動作環境