Skip to content

Create multitenant_memory_manager.go (closes #206) #207

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RAPIDENN
Copy link

@RAPIDENN RAPIDENN commented Jun 12, 2025

This commit implements the proposal from issue #206.

Implements per-user and per-project namespace isolation with memory limits, LRU eviction, and automatic cleanup after inactivity.

This change addresses a class of long-standing issues caused by unscoped memory and file descriptor usage in multi-session environments. It also prevents known edge cases such as hitting the 1024 FD limit in glibc’s select() implementation—an issue widely discussed by developers due to how it silently breaks applications when the descriptor count exceeds the hardcoded FD_SETSIZE. These bugs are notoriously difficult to trace and have led to crashes, corrupted state, and even exploitation in CTF challenges.

The new memory manager integrates with the language server via a LanguageServerExtension and requires minimal changes to the surrounding codebase. It improves scalability, stability, and memory safety in high-concurrency environments by ensuring each user/project session operates independently with enforced limits.

Extended Impact & Methodology Report
https://pdf-bjvf.vercel.app/impact207.html

RAPIDENN added 2 commits June 13, 2025 00:41
This commit implements the proposal from issue Exafunction#206 by @RAPIDENN.

- Solves:
  - Exafunction#63: memory leak (by limiting and cleaning memory usage)
  - Exafunction#176: too many open files (via per-namespace constraints)
@androidacy-user
Copy link

hope this gets merged soon! codeium/windsurf will randomly start using 12gb of ram on my machine - and i only have 32 :)

@RAPIDENN
Copy link
Author

Thanks a lot for confirming the issue, @androidacy-user!
If possible, could you share a screenshot showing both the high memory usage and your total system RAM (e.g. 32GB)? That would really help validate the problem for reviewers and show why PR #207 is crucial.

Appreciate it. Even a quick Task Manager or htop shot helps!

@androidacy-user
Copy link

Thanks a lot for confirming the issue, @androidacy-user! If possible, could you share a screenshot showing both the high memory usage and your total system RAM (e.g. 32GB)? That would really help validate the problem for reviewers and show why PR #207 is crucial.

Appreciate it. Even a quick Task Manager or htop shot helps!

not quite at 12gb right now, it happens randomly, but here is AS using about 1gb more than without windsurf, plus >2gb for the code server (plus a couple hundred mb for JCEF but thats negligible on my system). usually when it happens AS and cascade both become quite laggy though.

{720FF453-0D85-413A-BA0D-44C54DF160D9}

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

Successfully merging this pull request may close these issues.

2 participants