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

ingest memory leak issue #553

Closed
zdco opened this issue Dec 29, 2015 · 8 comments
Closed

ingest memory leak issue #553

zdco opened this issue Dec 29, 2015 · 8 comments
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@zdco
Copy link

zdco commented Dec 29, 2015

The latest branch code is being used for development. The SRS configuration file enables 100 ingest instances to collect the source.200kbps.768x320.flv file from the doc. The content of the configuration file is as follows:

listen 1935;
pid ./objs/srs.pid;
chunk_size 60000;
ff_log_dir /dev/null;
srs_log_tank file;
srs_log_level trace;
srs_log_file ./objs/srs.log;
max_connections 1000;
daemon off;
utc_time off;
heartbeat {
    enabled on;
    interval 9.3;
    url http://192.168.1.56:8080/api/v1/servers;
    device_id 001;
    summaries on;
}
stats {
    network 0;
    disk sda sdb xvda xvdb;
}
http_api {
    enabled on;
    listen 1985;
    crossdomain on;
    raw_api {
        enabled on;
        allow_reload on;
        allow_query on;
        allow_update on;
    }
}
http_server {
    enabled on;
    listen 9090;
    dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
    min_latency on;
    tcp_nodelay on;
    play {
        gop_cache off;
        queue_length 10;
        mw_latency 100;
    }
    publish {
        mr off;
    }
    hls {
        enabled on;
        hls_path ./objs/nginx/html;
        hls_fragment 4;
        hls_window 8;
        hls_on_error ignore;
        hls_storage ram;
        hls_mount [vhost]/[app]/[stream].m3u8;
    }
}
vhost ingest {
    ingest 1 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/1;
        }
    }
    ingest 2 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/2;
        }
    }
    ingest 3 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/3;
        }
    }
    ingest 4 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/4;
        }
    }
    ingest 5 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/5;
        }
    }
    ingest 6 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/6;
        }
    }
    ingest 7 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/7;
        }
    }
    ingest 8 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/8;
        }
    }
    ingest 9 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/9;
        }
    }
    ingest 10 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/10;
        }
    }
    ingest 11 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/11;
        }
    }
    ingest 12 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/12;
        }
    }
    ingest 13 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/13;
        }
    }
    ingest 14 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/14;
        }
    }
    ingest 15 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/15;
        }
    }
    ingest 16 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/16;
        }
    }
    ingest 17 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/17;
        }
    }
    ingest 18 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/18;
        }
    }
    ingest 19 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/19;
        }
    }
    ingest 20 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/20;
        }
    }
    ingest 21 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/21;
        }
    }
    ingest 22 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/22;
        }
    }
    ingest 23 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/23;
        }
    }
    ingest 24 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/24;
        }
    }
    ingest 25 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/25;
        }
    }
    ingest 26 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/26;
        }
    }
    ingest 27 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/27;
        }
    }
    ingest 28 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/28;
        }
    }
    ingest 29 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/29;
        }
    }
    ingest 30 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/30;
        }
    }
    ingest 31 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/31;
        }
    }
    ingest 32 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/32;
        }
    }
    ingest 33 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/33;
        }
    }
    ingest 34 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/34;
        }
    }
    ingest 35 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/35;
        }
    }
    ingest 36 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/36;
        }
    }
    ingest 37 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/37;
        }
    }
    ingest 38 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/38;
        }
    }
    ingest 39 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/39;
        }
    }
    ingest 40 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/40;
        }
    }
    ingest 41 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/41;
        }
    }
    ingest 42 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/42;
        }
    }
    ingest 43 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/43;
        }
    }
    ingest 44 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/44;
        }
    }
    ingest 45 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/45;
        }
    }
    ingest 46 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/46;
        }
    }
    ingest 47 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/47;
        }
    }
    ingest 48 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/48;
        }
    }
    ingest 49 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/49;
        }
    }
    ingest 50 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/50;
        }
    }
    ingest 51 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/51;
        }
    }
    ingest 52 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/52;
        }
    }
    ingest 53 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/53;
        }
    }
    ingest 54 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/54;
        }
    }
    ingest 55 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/55;
        }
    }
    ingest 56 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/56;
        }
    }
    ingest 57 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/57;
        }
    }
    ingest 58 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/58;
        }
    }
    ingest 59 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/59;
        }
    }
    ingest 60 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/60;
        }
    }
    ingest 61 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/61;
        }
    }
    ingest 62 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/62;
        }
    }
    ingest 63 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/63;
        }
    }
    ingest 64 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/64;
        }
    }
    ingest 65 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/65;
        }
    }
    ingest 66 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/66;
        }
    }
    ingest 67 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/67;
        }
    }
    ingest 68 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/68;
        }
    }
    ingest 69 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/69;
        }
    }
    ingest 70 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/70;
        }
    }
    ingest 71 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/71;
        }
    }
    ingest 72 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/72;
        }
    }
    ingest 73 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/73;
        }
    }
    ingest 74 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/74;
        }
    }
    ingest 75 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/75;
        }
    }
    ingest 76 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/76;
        }
    }
    ingest 77 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/77;
        }
    }
    ingest 78 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/78;
        }
    }
    ingest 79 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/79;
        }
    }
    ingest 80 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/80;
        }
    }
    ingest 81 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/81;
        }
    }
    ingest 82 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/82;
        }
    }
    ingest 83 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/83;
        }
    }
    ingest 84 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/84;
        }
    }
    ingest 85 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/85;
        }
    }
    ingest 86 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/86;
        }
    }
    ingest 87 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/87;
        }
    }
    ingest 88 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/88;
        }
    }
    ingest 89 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/89;
        }
    }
    ingest 90 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/90;
        }
    }
    ingest 91 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/91;
        }
    }
    ingest 92 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/92;
        }
    }
    ingest 93 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/93;
        }
    }
    ingest 94 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/94;
        }
    }
    ingest 95 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/95;
        }
    }
    ingest 96 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/96;
        }
    }
    ingest 97 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/97;
        }
    }
    ingest 98 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/98;
        }
    }
    ingest 99 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/99;
        }
    }
    ingest 100 {
        enabled on;
        input {
            type file;
            url ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled on;
            vcodec copy;
            acodec an;
            output rtmp://127.0.0.1:[port]/live/100;
        }
    }
}

After running for a period of time, it was discovered that the memory slowly increases. After running for a day, the program throws an error.

[2015-12-29 09:22:50.257][trace][1645][105] fork process: ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv -vcodec copy -an -f flv -y rtmp://127.0.0.1:1935/live/12 1 > ./objs/ffmpeg-ingest-ingest-live-12.log 2 > .
/objs/ffmpeg-ingest-ingest-live-12.log
[2015-12-29 09:22:50.286][trace][1645][105] vfored process, pid=5002, bin=./objs/ffmpeg/bin/ffmpeg
[2015-12-29 09:22:50.286][trace][1645][105] -> IGS time=79196662, ingesters=100, #52(alive=77846s, ingest/53)
[2015-12-29 09:22:50.330][trace][1645][133124] RTMP client ip=127.0.0.1, fd=19
[2015-12-29 09:22:50.331][trace][1645][133124] complex handshake success
[2015-12-29 09:22:50.371][trace][1645][133124] connect app, tcUrl=rtmp://127.0.0.1:1935/live, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=live, args=null
[2015-12-29 09:22:50.371][trace][1645][133124] out chunk size to 60000
[2015-12-29 09:22:50.451][trace][1645][133124] input chunk size to 60000
[2015-12-29 09:22:50.452][trace][1645][133124] client identified, type=fmle-publish, stream_name=12, duration=-1.00
[2015-12-29 09:22:50.452][trace][1645][133124] source url=/live/12, ip=127.0.0.1, cache=1, is_edge=0, source_id=-1[-1]
[2015-12-29 09:22:50.531][trace][1645][133124] hls: win=8.00, frag=4.00, prefix=, path=./objs/nginx/html, m3u8=[app]/[stream].m3u8, ts=[app]/[stream]-[seq].ts, aof=2.00, floor=0, clean=1, waitk=1, dispose=0
[2015-12-29 09:22:50.531][trace][1645][133124] ignore disabled exec for vhost=__defaultVhost__
[2015-12-29 09:22:50.541][trace][1645][133124] exec thread cid=133125, current_cid=133124
[2015-12-29 09:22:50.541][error][1645][133124][12] st_thread_create failed. ret=1017(Cannot allocate memory)
[2015-12-29 09:22:50.541][error][1645][133124][12] start isolate recv thread failed. ret=1017(Cannot allocate memory)
[2015-12-29 09:22:50.541][trace][1645][133124] unpublish drop ts segment, sequence_no=14022, uri=12-14022.ts, duration=0.00, start=18946800
[2015-12-29 09:22:50.541][trace][1645][133124] hls update m3u8 ok, mount=/live/12.m3u8
[2015-12-29 09:22:50.541][trace][1645][133124] cleanup when unpublish
[2015-12-29 09:22:50.541][error][1645][133124][4] stream service cycle failed. ret=1017(Interrupted system call)
[2015-12-29 09:22:51.844][trace][1645][131] hls update ts ok, mount=/live/2-13200.ts
[2015-12-29 09:22:51.844][trace][1645][131] hls update m3u8 ok, mount=/live/2.m3u8
[2015-12-29 09:22:51.844][trace][1645][131] hls remove ts ok, mount=/live/2-13198.ts
[2015-12-29 09:22:53.257][trace][1645][105] process pid=5002 terminate, restart it.
[2015-12-29 09:22:56.257][trace][1645][105] fork process: ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv -vcodec copy -an -f flv -y rtmp://127.0.0.1:1935/live/12 1 > ./objs/ffmpeg-ingest-ingest-live-12.log 2 > .
/objs/ffmpeg-ingest-ingest-live-12.log

During the retesting, the GMC memory leak detection was enabled, and the code was recompiled. The program was then run for one hour.

env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/srs.conf

The analysis results are as follows:

WARNING: Perftools heap leak checker is active -- Performance may suffer
[2015-12-29 09:41:07.510][trace][18424][0] config parse complete
[2015-12-29 09:41:07.511][trace][18424][0] write log to file ./objs/srs.log
[2015-12-29 09:41:07.511][trace][18424][0] you can: tailf ./objs/srs.log
[2015-12-29 09:41:07.511][trace][18424][0] @see: https://github.com/ossrs/srs/wiki/v1_CN_SrsLog


^CLeak check _main_ detected leaks of 155880 bytes in 4055 objects
The 16 largest leaks:
Using local file ./objs/srs.
Leak of 45080 bytes in 805 objects allocated from:
        @ 592384 _st_stack_new
        @ 591f4d st_thread_create
        @ 4dd9e0 internal::SrsThread::start
        @ 4da505 SrsReusableThread2::start
        @ 56f12b SrsRecvThread::start
        @ 570480 SrsPublishRecvThread::start
        @ 4a0e8f SrsRtmpConn::do_publishing
        @ 4a0d6e SrsRtmpConn::publishing
        @ 49f0d2 SrsRtmpConn::stream_service_cycle
        @ 49e347 SrsRtmpConn::service_cycle
        @ 49d3c9 SrsRtmpConn::do_cycle
        @ 49901a SrsConnection::cycle
        @ 4d9d9d SrsOneCycleThread::cycle
        @ 4dde1d internal::SrsThread::thread_cycle
        @ 4de037 internal::SrsThread::thread_fun
        @ 591892 _st_thre
Leak of 36512 bytes in 652 objects allocated from:
        @ 592384 _st_stack_new
        @ 591f4d st_thread_create
        @ 4dd9e0 internal::SrsThread::start
        @ 4da107 SrsReusableThread::start
        @ 585221 SrsNgExec::on_publish
        @ 4aecf9 SrsSource::on_publish
        @ 4a1a64 SrsRtmpConn::acquire_publish
        @ 4a0c8d SrsRtmpConn::publishing
        @ 49f0d2 SrsRtmpConn::stream_service_cycle
        @ 49e347 SrsRtmpConn::service_cycle
        @ 49d3c9 SrsRtmpConn::do_cycle
        @ 49901a SrsConnection::cycle
        @ 4d9d9d SrsOneCycleThread::cycle
        @ 4dde1d internal::SrsThread::thread_cycle
        @ 4de037 internal::SrsThread::thread_fun
        @ 591892 _st_thread_m
Leak of 28448 bytes in 1778 objects allocated from:
        @ 592854 st_cond_new
        @ 59204d st_thread_create
        @ 4dd9e0 internal::SrsThread::start
        @ 4da505 SrsReusableThread2::start
        @ 56f12b SrsRecvThread::start
        @ 570480 SrsPublishRecvThread::start
        @ 4a0e8f SrsRtmpConn::do_publishing
        @ 4a0d6e SrsRtmpConn::publishing
        @ 49f0d2 SrsRtmpConn::stream_service_cycle
        @ 49e347 SrsRtmpConn::service_cycle
        @ 49d3c9 SrsRtmpConn::do_cycle
        @ 49901a SrsConnection::cycle
        @ 4d9d9d SrsOneCycleThread::cycle
        @ 4dde1d internal::SrsThread::thread_cycle
        @ 4de037 internal::SrsThread::thread_fun
        @ 591892 _st_threa
Leak of 22624 bytes in 404 objects allocated from:
        @ 592384 _st_stack_new
        @ 591f4d st_thread_create
        @ 4dd9e0 internal::SrsThread::start
        @ 4d9d6f SrsOneCycleThread::start
        @ 498f97 SrsConnection::start
        @ 495615 SrsServer::accept_client
        @ 4900f0 SrsBufferListener::on_tcp_client
        @ 5827cb SrsTcpListener::cycle
        @ 4da1bf SrsReusableThread::cycle
        @ 4dde1d internal::SrsThread::thread_cycle
        @ 4de037 internal::SrsThread::thread_fun
        @ 591892 _st_thread_main
        @ 59202c st_thread_create
Leak of 10128 bytes in 105 objects allocated from:
        @ 5a8e0e CRYPTO_malloc
Leak of 5600 bytes in 100 objects allocated from:
        @ 592384 _st_stack_new
        @ 591f4d st_thread_create
        @ 4dd9e0 internal::SrsThread::start
        @ 4da107 SrsReusableThread::start
        @ 582beb SrsAsyncCallWorker::start
        @ 4b764d SrsHlsMuxer::initialize
        @ 4bd3a3 SrsHls::initialize
        @ 4a88fb SrsSource::initialize
        @ 4a734d SrsSource::create
        @ 49ea97 SrsRtmpConn::stream_service_cycle
        @ 49e347 SrsRtmpConn::service_cycle
        @ 49d3c9 SrsRtmpConn::do_cycle
        @ 49901a SrsConnection::cycle
        @ 4d9d9d SrsOneCycleThread::cycle
        @ 4dde1d internal::SrsThread::thread_cycle
        @ 4de037 internal::SrsThread::thread_fun
Leak of 832 bytes in 52 objects allocated from:
        @ 592854 st_cond_new
        @ 59204d st_thread_create
        @ 4dd9e0 internal::SrsThread::start
        @ 4da107 SrsReusableThread::start
        @ 582beb SrsAsyncCallWorker::start
        @ 4b764d SrsHlsMuxer::initialize
        @ 4bd3a3 SrsHls::initialize
        @ 4a88fb SrsSource::initialize
        @ 4a734d SrsSource::create
        @ 49ea97 SrsRtmpConn::stream_service_cycle
        @ 49e347 SrsRtmpConn::service_cycle
        @ 49d3c9 SrsRtmpConn::do_cycle
        @ 49901a SrsConnection::cycle
        @ 4d9d9d SrsOneCycleThread::cycle
        @ 4dde1d internal::SrsThread::thread_cycle
        @ 4de037 internal::SrsThread::thread_fun
        @ 59
Leak of 56 bytes in 1 objects allocated from:
        @ 592384 _st_stack_new
        @ 591f4d st_thread_create
        @ 591301 st_init
        @ 4dfb35 srs_st_init
        @ 491d13 SrsServer::initialize_st
        @ 590bc5 run_master
        @ 590896 run
        @ 590855 main
        @ 7f193f17ed5d __libc_start_main
Leak of 40 bytes in 1 objects allocated from:
        @ 593386 _st_netfd_new
        @ 593465 st_netfd_open
        @ 4908e3 SrsSignalManager::initialize
        @ 491f03 SrsServer::initialize_signal
        @ 590c00 run_master
        @ 590896 run
        @ 590855 main
        @ 7f193f17ed5d __libc_start_main
Leak of 40 bytes in 1 objects allocated from:
        @ 593386 _st_netfd_new
        @ 593486 st_netfd_open_socket
        @ 582585 SrsTcpListener::listen
        @ 48fe95 SrsBufferListener::listen
        @ 494c7c SrsServer::listen_rtmp
        @ 492576 SrsServer::listen
        @ 590c76 run_master
        @ 590896 run
        @ 590855 main
        @ 7f193f17ed5d __libc_start_main
Leak of 40 bytes in 1 objects allocated from:
        @ 593386 _st_netfd_new
        @ 593486 st_netfd_open_socket
        @ 582585 SrsTcpListener::listen
        @ 48fe95 SrsBufferListener::listen
        @ 494f6f SrsServer::listen_http_api
        @ 4925a5 SrsServer::listen
        @ 590c76 run_master
        @ 590896 run
        @ 590855 main
        @ 7f193f17ed5d __libc_start_main
Leak of 40 bytes in 1 objects allocated from:
        @ 593386 _st_netfd_new
        @ 593486 st_netfd_open_socket
        @ 582585 SrsTcpListener::listen
        @ 48fe95 SrsBufferListener::listen
        @ 495251 SrsServer::listen_http_stream
        @ 4925d1 SrsServer::listen
        @ 590c76 run_master
        @ 590896 run
        @ 590855 main
        @ 7f193f17ed5d __libc_start_main
Leak of 32 bytes in 1 objects allocated from:
        @ 528285 SrsPithyPrint::create_ingester
        @ 54f833 SrsIngester::SrsIngester
        @ 491cc0 SrsServer::initialize
        @ 59083d main
        @ 7f193f17ed5d __libc_start_main
Leak of 16 bytes in 1 objects allocated from:
        @ 592854 st_cond_new
        @ 59204d st_thread_create
        @ 4dd9e0 internal::SrsThread::start
        @ 4da505 SrsReusableThread2::start
        @ 56f12b SrsRecvThread::start
        @ 56f6a0 SrsQueueRecvThread::start
        @ 49f960 SrsRtmpConn::playing
        @ 49efd3 SrsRtmpConn::stream_service_cycle
        @ 49e347 SrsRtmpConn::service_cycle
        @ 49d3c9 SrsRtmpConn::do_cycle
        @ 49901a SrsConnection::cycle
        @ 4d9d9d SrsOneCycleThread::cycle
        @ 4dde1d internal::SrsThread::thread_cycle
        @ 4de037 internal::SrsThread::thread_fun
        @ 591892 _st_thread_main
        @ 59202c st_thread_create




If the preceding stack traces are not enough to find the leaks, try running THIS shell command:


pprof ./objs/srs "/tmp/srs.18424._main_-end.heap" --inuse_objects --lines --heapcheck  --edgefraction=1e-10 --nodefraction=1e-10 --gv


If you are still puzzled about why the leaks are there, try rerunning this program with HEAP_CHECK_TEST_POINTER_ALIGNMENT=1 and/or with HEAP_CHECK_MAX_POINTER_OFFSET=-1
If the leak report occurs in a small fraction of runs, try running with TCMALLOC_MAX_FREE_QUEUE_SIZE of few hundred MB or with TCMALLOC_RECLAIM_MEMORY=false, it might help find leaks more repeata
Exiting with error code (instead of crashing) because of whole-program memory leaks

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 29, 2015

There is no relationship between error reporting and memory leaks, right?

TRANS_BY_GPT3

@zdco
Copy link
Author

zdco commented Dec 30, 2015

I tested it again several times, and the memory leak is quite serious. On CentOS 6.5 system, with 100 ingest instances running for 12 hours, the system's VIRT increased from 200M to 2700M, and RES increased from 160M to 650M. However, according to the analysis results from gmc, the leak is not obvious.

Leak check _main_ detected leaks of 1819584 bytes in 48615 objects
The 15 largest leaks:
Using local file ./objs/srs.
Leak of 525672 bytes in 9387 objects allocated from:
        @ 57b7dc _st_stack_new
        @ 57b3a5 st_thread_create
        @ 4d3c38 internal::SrsThread::start
        @ 4d075d SrsReusableThread2::start
        @ 5585c3 SrsRecvThread::start
        @ 559918 SrsPublishRecvThread::start
        @ 4a0a97 SrsRtmpConn::do_publishing
        @ 4a0976 SrsRtmpConn::publishing
        @ 49ecc0 SrsRtmpConn::stream_service_cycle
        @ 49df35 SrsRtmpConn::service_cycle
        @ 49cfb7 SrsRtmpConn::do_cycle
        @ 498c32 SrsConnection::cycle
        @ 4cfff5 SrsOneCycleThread::cycle
        @ 4d4075 internal::SrsThread::thread_cycle
        @ 4d428f internal::SrsThread::thread_fun
        @ 57acea _st_th
Leak of 497336 bytes in 8881 objects allocated from:
        @ 57b7dc _st_stack_new
        @ 57b3a5 st_thread_create
        @ 4d3c38 internal::SrsThread::start
        @ 4d035f SrsReusableThread::start
        @ 56e6b9 SrsNgExec::on_publish
        @ 4ae5a1 SrsSource::on_publish
        @ 4a166c SrsRtmpConn::acquire_publish
        @ 4a0895 SrsRtmpConn::publishing
        @ 49ecc0 SrsRtmpConn::stream_service_cycle
        @ 49df35 SrsRtmpConn::service_cycle
        @ 49cfb7 SrsRtmpConn::do_cycle
        @ 498c32 SrsConnection::cycle
        @ 4cfff5 SrsOneCycleThread::cycle
        @ 4d4075 internal::SrsThread::thread_cycle
        @ 4d428f internal::SrsThread::thread_fun
        @ 57acea _st_thread
Leak of 376096 bytes in 23506 objects allocated from:
        @ 57bcac st_cond_new
        @ 57b4a5 st_thread_create
        @ 4d3c38 internal::SrsThread::start
        @ 4d075d SrsReusableThread2::start
        @ 5585c3 SrsRecvThread::start
        @ 559918 SrsPublishRecvThread::start
        @ 4a0a97 SrsRtmpConn::do_publishing
        @ 4a0976 SrsRtmpConn::publishing
        @ 49ecc0 SrsRtmpConn::stream_service_cycle
        @ 49df35 SrsRtmpConn::service_cycle
        @ 49cfb7 SrsRtmpConn::do_cycle
        @ 498c32 SrsConnection::cycle
        @ 4cfff5 SrsOneCycleThread::cycle
        @ 4d4075 internal::SrsThread::thread_cycle
        @ 4d428f internal::SrsThread::thread_fun
        @ 57acea _st_thr
Leak of 293440 bytes in 5240 objects allocated from:
        @ 57b7dc _st_stack_new
        @ 57b3a5 st_thread_create
        @ 4d3c38 internal::SrsThread::start
        @ 4cffc7 SrsOneCycleThread::start
        @ 498baf SrsConnection::start
        @ 495231 SrsServer::accept_client
        @ 48ff94 SrsBufferListener::on_tcp_client
        @ 56bc63 SrsTcpListener::cycle
        @ 4d0417 SrsReusableThread::cycle
        @ 4d4075 internal::SrsThread::thread_cycle
        @ 4d428f internal::SrsThread::thread_fun
        @ 57acea _st_thread_main
        @ 57b484 st_thread_create
Leak of 112448 bytes in 1196 objects allocated from:
        @ 59226e CRYPTO_malloc
Leak of 5600 bytes in 100 objects allocated from:
        @ 57b7dc _st_stack_new
        @ 57b3a5 st_thread_create
        @ 4d3c38 internal::SrsThread::start
        @ 4d035f SrsReusableThread::start
        @ 56c083 SrsAsyncCallWorker::start
        @ 4b6f01 SrsHlsMuxer::initialize
        @ 4bcc57 SrsHls::initialize
        @ 4a851f SrsSource::initialize
        @ 4a6f71 SrsSource::create
        @ 49e685 SrsRtmpConn::stream_service_cycle
        @ 49df35 SrsRtmpConn::service_cycle
        @ 49cfb7 SrsRtmpConn::do_cycle
        @ 498c32 SrsConnection::cycle
        @ 4cfff5 SrsOneCycleThread::cycle
        @ 4d4075 internal::SrsThread::thread_cycle
        @ 4d428f internal::SrsThread::thread_fun


Leak of 5544 bytes in 99 objects allocated from:
        @ 57b7dc _st_stack_new
        @ 57b3a5 st_thread_create
        @ 4d3c38 internal::SrsThread::start
        @ 4d035f SrsReusableThread::start
        @ 56c083 SrsAsyncCallWorker::start
        @ 54fe49 SrsDvrPlan::initialize
        @ 551648 SrsDvr::initialize
        @ 4a8586 SrsSource::initialize
        @ 4a6f71 SrsSource::create
        @ 49e685 SrsRtmpConn::stream_service_cycle
        @ 49df35 SrsRtmpConn::service_cycle
        @ 49cfb7 SrsRtmpConn::do_cycle
        @ 498c32 SrsConnection::cycle
        @ 4cfff5 SrsOneCycleThread::cycle
        @ 4d4075 internal::SrsThread::thread_cycle
        @ 4d428f internal::SrsThread::thread_fun
        @ 
Leak of 1600 bytes in 100 objects allocated from:
        @ 57bcac st_cond_new
        @ 57b4a5 st_thread_create
        @ 4d3c38 internal::SrsThread::start
        @ 4d035f SrsReusableThread::start
        @ 56c083 SrsAsyncCallWorker::start
        @ 4b6f01 SrsHlsMuxer::initialize
        @ 4bcc57 SrsHls::initialize
        @ 4a851f SrsSource::initialize
        @ 4a6f71 SrsSource::create
        @ 49e685 SrsRtmpConn::stream_service_cycle
        @ 49df35 SrsRtmpConn::service_cycle
        @ 49cfb7 SrsRtmpConn::do_cycle
        @ 498c32 SrsConnection::cycle
        @ 4cfff5 SrsOneCycleThread::cycle
        @ 4d4075 internal::SrsThread::thread_cycle
        @ 4d428f internal::SrsThread::thread_fun
        @ 
Leak of 1600 bytes in 100 objects allocated from:
        @ 57bcac st_cond_new
        @ 57b4a5 st_thread_create
        @ 4d3c38 internal::SrsThread::start
        @ 4d035f SrsReusableThread::start
        @ 56c083 SrsAsyncCallWorker::start
        @ 54fe49 SrsDvrPlan::initialize
        @ 551648 SrsDvr::initialize
        @ 4a8586 SrsSource::initialize
        @ 4a6f71 SrsSource::create
        @ 49e685 SrsRtmpConn::stream_service_cycle
        @ 49df35 SrsRtmpConn::service_cycle
        @ 49cfb7 SrsRtmpConn::do_cycle
        @ 498c32 SrsConnection::cycle
        @ 4cfff5 SrsOneCycleThread::cycle
        @ 4d4075 internal::SrsThread::thread_cycle
        @ 4d428f internal::SrsThread::thread_fun
        @ 5
Leak of 56 bytes in 1 objects allocated from:
        @ 57b7dc _st_stack_new
        @ 57b3a5 st_thread_create
        @ 57a759 st_init
        @ 4d5d8d srs_st_init
        @ 491b61 SrsServer::initialize_st
        @ 57a05d run_master
        @ 579d2e run
        @ 579ced main
        @ 7f452e108d5d __libc_start_main
Leak of 40 bytes in 1 objects allocated from:
        @ 57c7de _st_netfd_new
        @ 57c8bd st_netfd_open
        @ 490787 SrsSignalManager::initialize
        @ 491d51 SrsServer::initialize_signal
        @ 57a098 run_master
        @ 579d2e run
        @ 579ced main
        @ 7f452e108d5d __libc_start_main
Leak of 40 bytes in 1 objects allocated from:
        @ 57c7de _st_netfd_new
        @ 57c8de st_netfd_open_socket
        @ 56ba1d SrsTcpListener::listen
        @ 48fd39 SrsBufferListener::listen
        @ 494898 SrsServer::listen_rtmp
        @ 4923c4 SrsServer::listen
        @ 57a10e run_master
        @ 579d2e run
        @ 579ced main
        @ 7f452e108d5d __libc_start_main
Leak of 40 bytes in 1 objects allocated from:
        @ 57c7de _st_netfd_new
        @ 57c8de st_netfd_open_socket
        @ 56ba1d SrsTcpListener::listen
        @ 48fd39 SrsBufferListener::listen
        @ 494b8b SrsServer::listen_http_api
        @ 4923f3 SrsServer::listen
        @ 57a10e run_master
        @ 579d2e run
        @ 579ced main
        @ 7f452e108d5d __libc_start_main
Leak of 40 bytes in 1 objects allocated from:
        @ 57c7de _st_netfd_new
        @ 57c8de st_netfd_open_socket
        @ 56ba1d SrsTcpListener::listen
        @ 48fd39 SrsBufferListener::listen
        @ 494e6d SrsServer::listen_http_stream
        @ 49241f SrsServer::listen
        @ 57a10e run_master
        @ 579d2e run
        @ 579ced main
        @ 7f452e108d5d __libc_start_main
Leak of 32 bytes in 1 objects allocated from:
        @ 51814d SrsPithyPrint::create_ingester
        @ 53c463 SrsIngester::SrsIngester
        @ 491b0e SrsServer::initialize
        @ 579cd5 main
        @ 7f452e108d5d __libc_start_main

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 30, 2015

Grass...
You can try not using ffmpeg and see if ./objs/research/librtmp/srs_ingest_flv will be fine.

TRANS_BY_GPT3

@winlinvip winlinvip added the Bug It might be a bug. label Dec 30, 2015
@winlinvip
Copy link
Member

winlinvip commented Dec 30, 2015

Is it SRS2 or SRS3?

TRANS_BY_GPT3

@zdco
Copy link
Author

zdco commented Jan 4, 2016

The version is srs (ossrs) 3.0.6.
After starting one hundred srs_ingest_flv instances for streaming, srs_ingest_flv starts streaming. It automatically exits after reading the flv file.

nohup ./objs/research/librtmp/srs_ingest_flv -i doc/source.200kbps.768x320.flv -y rtmp://127.0.0.1/live/1 &
nohup ./objs/research/librtmp/srs_ingest_flv -i doc/source.200kbps.768x320.flv -y rtmp://127.0.0.1/live/2 &
nohup ./objs/research/librtmp/srs_ingest_flv -i doc/source.200kbps.768x320.flv -y rtmp://127.0.0.1/live/3 &
nohup ./objs/research/librtmp/srs_ingest_flv -i doc/source.200kbps.768x320.flv -y rtmp://127.0.0.1/live/4 &
......
nohup ./objs/research/librtmp/srs_ingest_flv -i doc/source.200kbps.768x320.flv -y rtmp://127.0.0.1/live/99 &
nohup ./objs/research/librtmp/srs_ingest_flv -i doc/source.200kbps.768x320.flv -y rtmp://127.0.0.1/live/100 &

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 4, 2016

Please test 2.0 and 1.0.

TRANS_BY_GPT3

@zdco
Copy link
Author

zdco commented Jan 4, 2016

Using SRS 2.0.206, after running for 3 hours, VIR increased from 170M to 650M, and RES increased from 120M to 270M. It is suspected that during the collection of FLV files, when reading data to the end of the file, there is a repeated forking of the ffmpeg process, which starts collecting from the beginning of the file again.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 9, 2016

Reference #559 is the issue with joining this thread. @tufang14 fixed it.

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Sep 23, 2021
@winlinvip winlinvip added this to the 2.0 milestone Sep 23, 2021
@winlinvip winlinvip changed the title ingest内存泄露的问题 ingest内存泄露的问题' translates to 'ingest memory leak issue' in English. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
@winlinvip winlinvip changed the title ingest内存泄露的问题' translates to 'ingest memory leak issue' in English. ingest memory leak issue Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants