-
Notifications
You must be signed in to change notification settings - Fork 455
Change Mlflow monitor process from fork to spawn to reduce memory usage #3830
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR resolves a memory hang issue in the MLflow monitor process by switching from fork to spawn, ensuring that the full model memory is released at the correct time.
- Updated process creation to use spawn context via spawn_context.Process.
- Replaced multiprocessing.Event with threading.Event in the run method.
- Revised signal handling by introducing SIGUSR1 and SIGUSR2 for normal and crash exits, respectively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! thanks, spawn ftw
What does this PR do?
The spawned mlflow monitor process was hanging on to memory for the whole model (initialized in the main process, and not freed until FSDP wrapping, which occurs after the monitor process is started). This resolves that by using spawn instead of fork for the monitor process.
Before and after memory usage:

Large model run that was hanging previously now works:
405b-mlf-after-1-Y26NwD
Manual test of error run:
70b-mlf-after-2-8OZEl7
Statuses all look correct:
