Skip to content
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

Introducing resource limits on Windows #85

Merged
merged 7 commits into from
Apr 29, 2023
Merged

Conversation

Maelkum
Copy link
Contributor

@Maelkum Maelkum commented Apr 27, 2023

This PR introduces resource limits on Windows. These are not request-specific limits, but cumulative limits for all Blockless Runtime executions.

Implementation

Resource limits are set using Job Objects.

Since Go syscall documentation is scarce, here is MSDN documentation for relevant syscalls:

Testing

To test this manually, I used this code to spin up a number of processes, and the hcsshim jobobject-util tool to query resource limits for the job object; also tweaked it locally to print out pids of the assigned processes.

Also tested with a full-fledged executor.

For Go test code, I spun up another process doing a sleep* and created resource limits for it.

* - because Windows doesn't have sleep by default and timeout.exe cannot be used in scripts, I used a variant with a ping to localhost to simulate sleep

@Maelkum Maelkum self-assigned this Apr 27, 2023
@Maelkum Maelkum requested a review from dmikey April 27, 2023 18:39
@dmikey dmikey merged commit e5f2d7d into main Apr 29, 2023
@dmikey dmikey deleted the limits-win-job-objects branch May 3, 2023 14:47
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