-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
Problems with repeatedly attaching to session - leaks memory and finally crashes #1948
Comments
More information: It seems |
Repro:
This also leaks memory :) Here is a version that counts how many attaches were possible: My build is now 5ad0429 |
My gut feeling tells me that there might be a fork without CLOEXEC used (either no OCLOEXEC set or no execv being used leading to file descriptor leaking into the child process), but this does not explain the memory leaks. Background: Rust libstd defaults to a mutex on process spawn, so other threads in the process should not leak it. See also rust-lang/rust#38227. |
This bug is also triggered when using something like |
I ran into this issue in practice. We had a number of users running zellij on a single machine until all instances crashed at some point of time. The logs showed the same Later I checked the number of open files, and found that zellij was using about 50k open file descriptors! The majority (85%) of them were Unix socket files for the server-client communication. About half of them were used by the "async-std" thread. Any ideas on how to get to the root of this issue? Would it be of any merit to build a server-client toy example that uses a LocalSocketListener in a separate thread? |
… - leaks memory and finally crashes')
Just submitted a PR that fixes this issue, see #2322 . |
Nice! It fixes the crashes. I fear we might still have a small memory leak tho:
This works out to 24kB leaked for each client / attach. |
Here is what I found about allocators in another issue: #1625 (comment) |
Btw i pushed the branch with jemalloc as allocator here: https://github.com/zellij-org/zellij/tree/jemalloc |
I am aware of the allocator playing a role, but this case looks like a leak to me: Tell me if any of these would be helpful:
|
Just some stress testing with rapid attaching and detaching yielded this possible server crash locations:
My build is at dc92290
The text was updated successfully, but these errors were encountered: