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

Boost Coroutines: Increase the default stack size from 64 to 256KB #7713

Merged
merged 1 commit into from
Dec 13, 2019

Conversation

dnsmichi
Copy link
Contributor

With #6559 I have learned that the default stack size for coroutines may to low causing crashes on Windows in this regard. The default of 64KB may be too low, especially keeping in mind that for example nlohmann/json puts an overhead of 1 pointer for each JSON object. If many of them are used within a coroutine, e.g. an agent/satellite replaying the log, the theory says that 64KB may be too low.

Our application default would be 256KB the lowest, if the application is not started with --no-stack-rlimit (which is the default param used on Debian and RHEL).

int Application::GetDefaultRLimitStack()
{
        return 256 * 1024;
}

Therefore I consider setting a Coroutine stack size of 256KB (maybe 512KB) a better default than the Boost ASIO default. This may increase the memory foot print of course, but prevent any stack corruption which likely happens here.

References I had in my pocket:

refs #7532

@dnsmichi dnsmichi added this to the 2.12.0 milestone Dec 13, 2019
@dnsmichi dnsmichi added area/runtime Downtimes, comments, dependencies, events core/quality Improve code, libraries, algorithms, inline docs labels Dec 13, 2019
@dnsmichi dnsmichi merged commit cd44c53 into master Dec 13, 2019
@dnsmichi dnsmichi deleted the bugfix/coroutine-stack-size-linux branch December 13, 2019 16:30
@dnsmichi dnsmichi mentioned this pull request Dec 13, 2019
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runtime Downtimes, comments, dependencies, events core/quality Improve code, libraries, algorithms, inline docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant