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

Failed to increase stack memory #49

Open
dertin opened this issue Feb 3, 2023 · 4 comments
Open

Failed to increase stack memory #49

dertin opened this issue Feb 3, 2023 · 4 comments

Comments

@dertin
Copy link

dertin commented Feb 3, 2023

Why does increasing the stack memory cause an error when creating the background thread?

tikv-jemallocator = {version = "0.5", features = ["background_threads"] }

ulimit -s 536870912
./my-program

result:
<jemalloc>: arena 0 background thread creation failed (11)

@BusyJay
Copy link
Member

BusyJay commented Feb 6, 2023

Maybe it's just too large (512MiB) for the thread to be spawn.

@dertin
Copy link
Author

dertin commented Feb 6, 2023

It only gives a problem when we have activated the features = ["background_threads"]

I tried with values of stack memory lower than 512MB and the problem is present when setting any value outside the default.

ulimit -s <bytes> this should increase the stack memory over the main function.

I tried to increase the stack memory for threads but it didn't fix the problem.
RUSTFLAGS="-C link-args=-Wl,-zstack-size=<bytes>"
RUST_MIN_STACK=<bytes>

What is this behavior due to?

@BusyJay
Copy link
Member

BusyJay commented Feb 6, 2023

When enabling background_threads, background threads are created to do purging in the background. The error code 11 is "Resource temporarily unavailable" and returned when spawning the thread in C. Not look into the code yet, but I think it's probably due to 512MB is not a good value.

@dertin
Copy link
Author

dertin commented Feb 8, 2023

There should be no problem with thread creation if there is more stack memory for the main function.

Higher stack memory values are used for applications with high recursion, among other rare cases. I think it would be good to find the cause to better understand the operation of what is happening in the back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants