SmartPtr: Support load test for source by srs-bench. v6.0.130#4097
SmartPtr: Support load test for source by srs-bench. v6.0.130#4097winlinvip merged 11 commits intoossrs:developfrom
Conversation
| if (!enabled) { | ||
| return 0; | ||
| } | ||
| return _srs_config->get_dash_dispose(req->vhost) * 1.1; |
There was a problem hiding this comment.
dash_dispose is not illustrated in full.conf, which can be used as the doc. It's better to add it to full.conf.
Another problem, the default dash_dispose config is 0, or user can config the [hls | dash]_dispose to 0 second, then this cleanup_delay will be 0, is the cleanup_delay has to be keep > 0 ? In this case:
_srs_config->get_dash_dispose(req->vhost) > 0 ? _srs_config->get_dash_dispose(req->vhost) * 1.1 : 1
Let the cleanup_delay at least 1 second.
There was a problem hiding this comment.
Add dash_dispose to full.conf.
If user config dispose to 0, this cleanup_delay will return 0, which will be ignored.
It works as expectation. Won't fix.
| # @remark apply for publisher timeout only, while "etc/init.d/srs stop" always dispose DASH. | ||
| # Overwrite by env SRS_VHOST_DASH_DASH_DISPOSE for all vhosts. | ||
| # default: 120 | ||
| dash_dispose 120; |
There was a problem hiding this comment.
srs/trunk/src/app/srs_app_config.cpp
Lines 6862 to 6866 in e3d74fb
the default value in the code need to match the value here, be careful, change the default value in the srs_app_config may has impact.
There was a problem hiding this comment.
The previous default value is 0, but hls dispose defaults to 120. I think it's ok to change to the same.
There was a problem hiding this comment.
I didn't notice the dash_dispose default value in srs_app_config.cpp already changed to 120 to match the full.conf. No problem here.
| } | ||
|
|
||
| std::string vhost = pattern; | ||
| if (pattern.at(0) != '/') { |
There was a problem hiding this comment.
vhosts store the vhost -> ISrsHttpHandler map, but the value, ISrsHttpHandler never used, so is is ok to downgrade the map -> set?
About the code to extract the vhost, they are repeated in:
srs/trunk/src/protocol/srs_protocol_http_stack.cpp
Lines 706 to 712 in e3d74fb
Maybe a another method to get the vhost from pattern.
There was a problem hiding this comment.
Need another PR to refine the code, because it not about the smart ptr.
Won't fix in this PR.
| @@ -691,14 +691,12 @@ srs_error_t SrsHttpServeMux::handle(std::string pattern, ISrsHttpHandler* handle | |||
| srs_assert(handler); | |||
|
|
|||
| if (pattern.empty()) { | |||
| srs_freep(handler); | |||
There was a problem hiding this comment.
The ISrsHttpHander memory release still not perfect.
For a normal process, the ISrsHttpHandler is created in:
srs/trunk/src/app/srs_app_http_stream.cpp
Line 991 in e3d74fb
and released in
srs/trunk/src/protocol/srs_protocol_http_stack.cpp
Lines 624 to 627 in e3d74fb
I would think if it's possible to manager it in same place, SrsLiveEntry in this case. I see the auto release in SrsHttpStreamServer::http_unmount(SrsRequest* r), the ISrsHttpHander, or SrsLiveStream, seems freed twice in SrsHttpMuxEntry destructor and SrsHttpStreamServer::http_unmount
And For exception cases, like here, handler not freed here, but this exception not handled well, the handler not released below at least.
srs/trunk/src/app/srs_app_http_stream.cpp
Lines 1008 to 1010 in e3d74fb
There was a problem hiding this comment.
First, in http_unmount, won't free it twice, please check it carefully.
Second, if mux.handle failed, it won't free the stream, but the http_unmount will do.
So I think it's ok. Won't fix.
| sflvs.erase(it); | ||
|
|
||
| SrsLiveStream* stream = entry->stream; | ||
| SrsAutoFree(SrsLiveStream, stream); |
There was a problem hiding this comment.
the SrsAutoFree not good enough here, when stream being released, stream = NULL, but the entry->stream still hold an not NULL pointer, but it's memory already released.
So is it a good idea to let the SrsLiveEntry destructor to free stream, cache?
There was a problem hiding this comment.
I think it's ok, because the entry is removed and freed:
SrsLiveEntry* entry = it->second;
SrsAutoFree(SrsLiveEntry, entry);
streamHandlers.erase(it);
SrsLiveStream* stream = entry->stream;
SrsAutoFree(SrsLiveStream, stream);
SrsBufferCache* cache = entry->cache;
SrsAutoFree(SrsBufferCache, cache);Won't fix.
253bfe6 to
a49f089
Compare
## Cause dash auto dispose is configured by seconds, but the code compare by usecond, 1 second = 1,000,000 useconds. releated to #4097 Bug introduced after #4097 supported Dash auto dispose after a timeout without media data. ## How to reproduce 1. `./objs/srs -c conf/dash.conf` 2. publish a rtmp stream. 3. play dash stream. -> no dash stream, always 404 error. --------- Co-authored-by: winlin <winlinvip@gmail.com>
Co-authored-by: Haibo Chen 495810242@qq.com
Co-authored-by: Jacob Su suzp1984@gmail.com