Skip to content

fix: protect mastercontainer from OOM situations#8082

Open
Copilot wants to merge 4 commits into
mainfrom
copilot/investigate-oom-situations
Open

fix: protect mastercontainer from OOM situations#8082
Copilot wants to merge 4 commits into
mainfrom
copilot/investigate-oom-situations

Conversation

Copilot AI commented May 12, 2026

Copy link
Copy Markdown
Contributor

Sets oom_score_adj: -500 in compose.yaml and adds --oom-score-adj -500 to all docker run commands in the documentation. This instructs the Linux OOM killer to strongly prefer killing other processes before the mastercontainer, keeping the AIO interface accessible even under memory pressure.

Changes Made

  • compose.yaml — added oom_score_adj: -500 with an explanatory comment
  • readme.md--oom-score-adj -500 added to Linux and Windows docker run commands; explanation bullet added in the <details> section
  • reverse-proxy.md — same: Linux + Windows commands and explanation bullet
  • multiple-instances.md, develop.md, php/README.md--oom-score-adj -500 added to each mastercontainer docker run invocation

Comment thread compose.yaml Outdated
Comment thread Containers/mastercontainer/Dockerfile Outdated
Signed-off-by: Simon L. <szaimen@e.mail.de>
@szaimen szaimen added 3. to review Waiting for reviews and removed 2. developing Work in progress labels May 12, 2026
@szaimen szaimen marked this pull request as ready for review May 12, 2026 11:40

@Zoey2936 Zoey2936 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would strongly recommend to NOT do this, it makes no sense giving the mastercontainer a lower value then the hosts init process or docker itself.

@szaimen

szaimen commented May 12, 2026

Copy link
Copy Markdown
Collaborator

@copilot please change the -1000 value to -500

Copilot AI commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please change the -1000 value to -500

Done. Changed all occurrences of -1000 to -500 across compose.yaml, readme.md, reverse-proxy.md, develop.md, multiple-instances.md, and php/README.md, and updated the explanatory text accordingly (commit 988258b).

@szaimen szaimen requested a review from Zoey2936 May 12, 2026 13:08
@szaimen

szaimen commented May 12, 2026

Copy link
Copy Markdown
Collaborator

@Zoey2936 is this better now?

@Zoey2936

Zoey2936 commented May 12, 2026

Copy link
Copy Markdown
Collaborator

At least on my system the oom_score is calculates like this: 666 + ((ram-usage / total-ram-swap) * 666), the first 666 comes from it being a non privileged process. So this means setting the adj to -667 or lower will always make it better then any non-privileged process. I think the score of containers should be similiar to expected memory usage. if you understand

@szaimen szaimen modified the milestones: v13.0.4, next May 15, 2026
@szaimen

szaimen commented May 19, 2026

Copy link
Copy Markdown
Collaborator

At least on my system the oom_score is calculates like this: 666 + ((ram-usage / total-ram-swap) * 666), the first 666 comes from it being a non privileged process. So this means setting the adj to -667 or lower will always make it better then any non-privileged process. I think the score of containers should be similiar to expected memory usage. if you understand

I fear I don't really understand. Can you maybe make some suggestions how you would choose the values?

In my opinion the values should be chosen based on the importance of each component for the whole system. Is that not the best approach?

@Zoey2936

Copy link
Copy Markdown
Collaborator

In my opinion the values should be chosen based on the importance of each component for the whole system. Is that not the best approach?

Yes, but we can't assume that users set this value for all services running on the server, which are not managed by AIO

@szaimen

szaimen commented May 19, 2026

Copy link
Copy Markdown
Collaborator

In my opinion the values should be chosen based on the importance of each component for the whole system. Is that not the best approach?

Yes, but we can't assume that users set this value for all services running on the server, which are not managed by AIO

So what would be your approach to the idea of adding this value to the aio cotnainers and especiall the mastercontainer? Having the value set for the mastercontainer will not automatically kill other applications iirc...

@Zoey2936

Copy link
Copy Markdown
Collaborator

Yes, but in theory the docker daemon could be killed before the master container in theory an example

@szaimen

szaimen commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Yes, but in theory the docker daemon could be killed before the master container in theory an example

I see so i guess the value here for the mastercontainer should be lower than the value of the docker daemon right?

@Zoey2936

Copy link
Copy Markdown
Collaborator

the docker deamon should be killed after the container

@szaimen

szaimen commented May 26, 2026

Copy link
Copy Markdown
Collaborator

the docker deamon should be killed after the container

I just checked and the default value for the docker daemon seems to be -500. So having -500 for the mastercontainer should be fine imho. WDYT?

@Zoey2936

Zoey2936 commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Where do you have the -500 from?

@szaimen

szaimen commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Where do you have the -500 from?

image

@Zoey2936

Copy link
Copy Markdown
Collaborator

Ohhh that explains it, my server uses alpine as host os which does not set this value. Maybe this could be connected to an env?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants