Skip to content

Use isolate's cg-oom-killed to detect "memory limit exceeded" conditions - #1471

Merged
prandla merged 3 commits into
cms-dev:mainfrom
e-i-o:cg-oom
Aug 4, 2025
Merged

Use isolate's cg-oom-killed to detect "memory limit exceeded" conditions#1471
prandla merged 3 commits into
cms-dev:mainfrom
e-i-o:cg-oom

Conversation

@prandla

@prandla prandla commented Jul 22, 2025

Copy link
Copy Markdown
Member

Closes #912.

I deleted the extra text from killed-by-signal's help text because it's not relevant there anymore (I hope). I didn't re-add it to the new error's help text because in my experience, it's not true: in all cases I have tried, the oom killer has been precise enough that the reported memory use is exactly the task's memory limit (up to the rounding precision, at least). The behaviour that was described in that deleted paragraph might have been possible with non-cgroups isolate? I'm not sure.

Also, PHP has a memory_limit setting that limits the amount of memory the interpreter even tries to allocate; this limit is 128M by default. Exceeding this causes PHP to exit with code 255 (and print a message on stdout). This broke the new tests (and in fact, this could have been caught earlier: all the other oom tests were killed by signal, whereas php was nonzero exit code, but this fact was not checked by the test). Actually, this was a bigger problem, in that PHP enforced a 128MB memory limit, ignoring whatever the task's memory limit was. This would be possible to fix in php.ini on worker machines, but the contest administrators would have to be aware of it. I fixed it by changing the limit to -1 (meaning "infinite") using a command-line argument.

@veluca93
veluca93 requested a review from gollux July 23, 2025 09:03

@gollux gollux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree, but please wait with merging until the end of this IOI.

prandla added 3 commits August 4, 2025 23:13
PHP has a memory_limit setting that limits the amount of memory the
interpreter even tries to allocate; this limit is 128M by default.
Exceeding this causes PHP to exit with code 255 (and print a message on
stdout).

This commit changes the limit to infinity, and lets isolate's memory
limit handle it instead. This gives the correct feedback to contestants.
@prandla
prandla merged commit a7dca91 into cms-dev:main Aug 4, 2025
3 checks passed
@prandla
prandla deleted the cg-oom branch August 5, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Use isolate's cg-oom-killed

3 participants