Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long urls return error 500 #1551

Open
cescp opened this issue Nov 13, 2024 · 0 comments
Open

Long urls return error 500 #1551

cescp opened this issue Nov 13, 2024 · 0 comments

Comments

@cescp
Copy link

cescp commented Nov 13, 2024

I'm using nginx-vod-module version 1.33 to access remote content in HLS.
As I'm using tokens (verified by a Lambda function in an Amazon CloudFront distribution) urls can be quite long.
I configured vod module so as it removes the token part from url before calling the remote server, but token must be preserved in manifest and segment urls.
When the length of urls achieves a certain value, an error 500 is returned:
m3u8_builder_build_master_playlist: result length 2265 exceeded allocated length 2263 while sending to client
Removing some characters makes it work fine again.

This is a minimal configuration to reproduce the problem. In this case local server is acting as the remote one:

server {
    listen 80;

    # remove vod and /token/<token> (if present)
    location ~ /media_proxy/[^/]+/(?:token/[^/]+/)?(.*) {
        internal;
        proxy_pass http://127.0.0.1/$1;
    }
    
    # ok:
    # http://192.168.1.147/vod/content/video_,720,360,.mp4.urlset/master.m3u8
    # http://192.168.1.147/vod/token/1234/content/video_,720,360,.mp4.urlset/master.m3u8
    # http://192.168.1.147/vod/token/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/content/video_,720,360,.mp4.urlset/master.m3u8
    #
    # error 500: m3u8_builder_build_master_playlist: result length 2265 exceeded allocated length 2263 while sending to client
    # http://192.168.1.147/vod/token/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/content/video_,720,360,.mp4.urlset/master.m3u8
    location /vod/ {
        # nginx-vod-module-1.33
        vod_mode remote;
        vod_upstream_location /media_proxy;
        vod hls;
    }

    # access to mp4 local files: /web/video_360.mp4, /web/video_720.mp4
    location /content/ {
        root /web/;
    }
}

I debugged the code and I've seen that in https://github.com/kaltura/nginx-vod-module/blob/1.33/vod/hls/m3u8_builder.c#L1420 the contribution to result_size due to iframe playlist does not increase when the length of the url increases. I guess that for short urls, the value of result_size is oversized enough from contributions in https://github.com/kaltura/nginx-vod-module/blob/1.33/vod/hls/m3u8_builder.c#L1415 and causes no problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant