Skip to content

Commit

Permalink
Limit the number of threads for subprocess tests
Browse files Browse the repository at this point in the history
Tests created using std.test.Tests.fork now limit the number of Inko
threads the subprocess uses, reducing the chances of such tests reaching
thread count limits and thus crashing the test.

Changelog: fixed
  • Loading branch information
yorickpeterse committed Sep 12, 2024
1 parent b7c6621 commit 3a17396
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions std/src/std/test.inko
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ class pub Process {
cmd.stdout = Stream.Piped
cmd.stderr = Stream.Piped
cmd.variables.set(CHILD_VAR, id.to_string)

# Inko uses a set of thread pools for running processes, with their sizes
# depending on the number of CPU cores. We limit the number of threads here
# so we don't overload the system when running sub process tests on systems
# with many CPU cores.
cmd.variables.set('INKO_PROCESS_THREADS', '1')
cmd.variables.set('INKO_BACKUP_THREADS', '1')
Process(cmd: cmd, stdin: '')
}

Expand Down

0 comments on commit 3a17396

Please sign in to comment.