]> Cypherpunks repositories - gostls13.git/commit
runtime: exclude extra M's from debug.SetMaxThreads
authorMichael Pratt <mpratt@google.com>
Fri, 5 May 2023 20:58:43 +0000 (16:58 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 9 May 2023 17:55:20 +0000 (17:55 +0000)
commit734b26d4b9b90cab4b770a8d55fdaeb3a7683bd7
tree75acfc80f6a660bec36a7f60c6e155b238b76300
parent5751939d1161456f380efbb5c5d0a8962006eea4
runtime: exclude extra M's from debug.SetMaxThreads

The purpose of the debug.SetMaxThreads limit is to avoid accidental fork
bomb from something like millions of goroutines blocking on system
calls, causing the runtime to create millions of threads.

By definition we don't create threads created in C, so this isn't a
problem for those threads, and we can exclude them from the limit. If C
wants to create tens of thousands of threads, who are we to say no?

Fixes #60004.

Change-Id: I62b875890718b406abca42a9a4078391e25aa21b
Reviewed-on: https://go-review.googlesource.com/c/go/+/492743
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
src/runtime/proc.go