From 9a963c6fd2514bba74548010a27905a92fa600b4 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 31 Oct 2020 21:27:09 +0800 Subject: [PATCH] Fix #509, Always malloc stack on heap. 3.0.153 --- README.md | 1 + trunk/.gitignore | 1 + trunk/auto/depends.sh | 2 ++ trunk/src/app/srs_app_server.cpp | 12 ------------ trunk/src/core/srs_core_version3.hpp | 2 +- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7754747f77..4f112dc011 100755 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-10-31, Fix [#509][bug #509], Always malloc stack on heap. 3.0.153 * v3.0, 2020-10-31, Remove some global elements for debugging. 3.0.152 * v3.0, 2020-10-31, Use global _srs_server for debugging. 3.0.151 * v3.0, 2020-10-31, Refine source cid, track previous one. 3.0.150 diff --git a/trunk/.gitignore b/trunk/.gitignore index 4431df72c2..7d0164b16a 100644 --- a/trunk/.gitignore +++ b/trunk/.gitignore @@ -41,3 +41,4 @@ srs *.h264 *.264 3rdparty/ffmpeg-4.2-fit +bug diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index e9d33609c8..c320502f3f 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -316,6 +316,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then if [[ $SRS_OSX == YES ]]; then _ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_KQUEUE" && _ST_LD=${SRS_TOOL_CC} && _ST_OBJ="DARWIN_*" fi + # Always alloc on heap, @see https://github.com/ossrs/srs/issues/509#issuecomment-719931676 + _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMALLOC_STACK" # Pass the global extra flags. if [[ $SRS_EXTRA_FLAGS != '' ]]; then _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS" diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 2ca4321edb..381e320420 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -769,18 +769,6 @@ srs_error_t SrsServer::initialize_st() if ((err = srs_st_init()) != srs_success) { return srs_error_wrap(err, "initialize st failed"); } - - // @remark, st alloc segment use mmap, which only support 32757 threads, - // if need to support more, for instance, 100k threads, define the macro MALLOC_STACK. - // TODO: FIXME: maybe can use "sysctl vm.max_map_count" to refine. -#define __MMAP_MAX_CONNECTIONS 32756 - if (_srs_config->get_max_connections() > __MMAP_MAX_CONNECTIONS) { - srs_error("st mmap for stack allocation must <= %d threads, " - "@see Makefile of st for MALLOC_STACK, please build st manually by " - "\"make EXTRA_CFLAGS=-DMALLOC_STACK linux-debug\"", __MMAP_MAX_CONNECTIONS); - return srs_error_new(ERROR_ST_EXCEED_THREADS, "%d exceed max %d threads", - _srs_config->get_max_connections(), __MMAP_MAX_CONNECTIONS); - } // set current log id. _srs_context->generate_id(); diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp index 4f7a26305c..37451726f8 100644 --- a/trunk/src/core/srs_core_version3.hpp +++ b/trunk/src/core/srs_core_version3.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP -#define SRS_VERSION3_REVISION 152 +#define SRS_VERSION3_REVISION 153 #endif