AirenSoft / OvenMediaEngine

OvenMediaEngine (OME) is a Sub-Second Latency Live Streaming Server with Large-Scale and High-Definition. #WebRTC #LLHLS
https://OvenMediaEngine.com/ome
GNU Affero General Public License v3.0
2.53k stars 1.06k forks source link

LLHLS Publisher - Playback fails if there are multiple client sessions #1303

Closed bchah closed 1 year ago

bchah commented 1 year ago

Describe the bug When viewing more than one stream at a time from an LLHLS publisher, playback of both streams starts to fail.

To Reproduce Open one LLHLS stream, then a second one in a new browser window. 'Invalid session_key' will begin to appear in the logs and playback will either hit errors or fail completely. Once you stop the second stream, playback of the first stream will resume normally and the 'Invalid session_key' errors disappear.

Expected behavior Playback of one LLHLS stream should not impact playback of a different stream from the same client.

Logs log.txt

Server (please complete the following information): Docker dev image, latest commits

Player (please complete the following information): Chrome and Safari on macOS

Additional context In my testing reflected in the log file, you can see alternating playback of one stream and the other, with no issue. Then when both streams are opened you will see the 'Invalid session_key' errors start streaming in.

getroot commented 1 year ago

Hmm... I can't reproduce this. Playing with multiple streams and multiple sessions works just fine.

The only way I can reproduce this similarly is:

  1. Enable AdmissionWebhooks or SignedPolicy, OriginMode is false
  2. Create stream, play LLHLS
  3. Deleting the stream without UNLOADing the player in (2) (the player is still retrying)
  4. Create stream again
  5. Invalid session key message output

The reason for the above reproduction (5) is that the player did not load from the master playlist. AdmissionWebhooks or SignedPolicy checks only the master playlist for efficiency, not subsequent chunklis or segments. If the master playlist authentication passes, a session key is issued, which authorizes subsequent segment downloads.

OvenPlayer or other players download the master playlist only once. Even if the server recreates the stream, the player will not download the master playlist again until RELOAD. Since the previously issued session key has already been deleted when the stream is deleted, it is not valid for the newly created stream. When the stream is recreated, the session key previously issued to the player has already expired, so this is a normal case for security reasons.

Please let me know if the issue reproduces after UNLOAD PLAYER -> LOAD PLAYER. If your problem is not the case above, please write a little more detail on how to reproduce it. The browser you use or the timing of stream creation (your logs don't have any logs about stream creation, did you delete them on purpose?) may also be important. Server.xml is also required.

bchah commented 1 year ago

Thank you @getroot - I have tested this again with the latest commits + latest version of hls.js, and cannot reproduce it anymore. I had hit that error after a long day of testing so there could be some other factors I didn't realize. Sorry for the poor reporting 😅

One thing regarding logs... for logger.xml this is the configuration I am using so I don't know why the stream creation logs you are looking for aren't being included:

<Logger version="2">
    <Path>/log/engine</Path>
    <!-- HttpServer is overly verbose so should always be supressed -->
    <Tag name="HttpServer" level="critical"/>
    <Tag name=".*" level="info" />
</Logger>