Skip to content

Commit

Permalink
Fix #509, Always malloc stack on heap. 3.0.153
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Oct 31, 2020
1 parent 86f8cbb commit 9a963c6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions trunk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ srs
*.h264
*.264
3rdparty/ffmpeg-4.2-fit
bug
2 changes: 2 additions & 0 deletions trunk/auto/depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 0 additions & 12 deletions trunk/src/app/srs_app_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

This comment has been minimized.

Copy link
@winlinvip

winlinvip Oct 31, 2020

Author Member

Change to alloc stack on heap, so we removed this limit.


// set current log id.
_srs_context->generate_id();
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9a963c6

Please sign in to comment.