Skip to content

Firefox hls.js prone to completely failing and struggling to recover with specific setup... #7531

Description

@twilson90

What do you want to do with Hls.js?

I have a custom implementation of an HLS server which I've written myself.

It serves a rolling 2 hour window of video for a long running livestream (usually lasting around 8 hours), segments are 2 seconds long.
Initially a client will receive the last 2 hours of segments (or however long the stream has been running if less than 2 hours)
Then the client will receive delta updates of the last 10 segments.

Users have recently been complaining of an issue which I can't easily reproduce, whereby the player completely stops playing completely and appears in a eternally buffering state.
Changing the variant or seeking does not fix it, the only way for it to start playing again is after a full reload.

Users I've spoken to the freezes very frequently, every 10-15 minutes or less, I think they are all FireFox users.

I managed to record an instance of this occurring earlier (in Firefox). I left it running for 2 hours and exactly at the 2 hour mark, it froze and stopped playing.
At the same time I started monitoring Firefox, I left the same stream playing in Chrome and it never froze or produced a single console error.

According to the network pane in Dev Tools, prior to moment it stops, a delta playlist update is requested and I received an empty response.
I have checked, double-checked and triple-checked my implementation, and I cannot see how this happens unless the server is just dropping requests or doing its own thing.
I'm not entirely sure why hls.js would handle an empty response so poorly though, to completely stop and never recover.

It's more than a little coincidental that when I managed to trigger the freeze, it occurred at almost exactly the 2 hour mark, the same as the duration of the live window (2 hours)...
Also, I'd set the CAN-SKIP-UNTIL tag in all responses to 7200 (2 hours), believing this to be correct. After some googling I now realise a more appropriate value would be more like 20 or 30...
I'm still completely confused how this could trigger an empty server response or for the player to completely hang.
Also why some users experience freezes much more frequently then myself.

Here is a complete log from firefox with debug:true

firefox-log.txt

And here is the second to last response before it froze [https://mysite.com/media/live/37/480p/stream.m3u8?_HLS_msn=6485&_HLS_skip=YES]

final-m3u8.txt

The following request https://mysite.com/media/live/37/480p/stream.m3u8?_HLS_msn=6486&_HLS_skip=YES resulted in an apparently empty response.

Stranger yet, the moment the livestream ended (several hours later) I observed the still frozen video suddenly start playing again - precisely at the moment when it received a delta response indicating the end of the playlist.

Can anyone make sense of this?

What have you tried so far?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    Top priorities

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions