Merge "Set GODEBUG=asyncpreemptoff=1 for soong_build."

This commit is contained in:
Lukács T. Berki 2022-01-05 09:06:19 +00:00 committed by Gerrit Code Review
commit 1a1ec4b59c

View file

@ -124,10 +124,27 @@ var (
// better to not to touch that while Blueprint and Soong are separate
// NOTE: The spaces at EOL are important because otherwise Ninja would
// omit all spaces between the different options.
// GODEBUG=asyncpreemptoff=1 disables the preemption of goroutines. This
// is useful because the preemption happens by sending SIGURG to the OS
// thread hosting the goroutine in question and each signal results in
// work that needs to be done by Delve; it uses ptrace to debug the Go
// process and the tracer process must deal with every signal (it is not
// possible to selectively ignore SIGURG). This makes debugging slower,
// sometimes by an order of magnitude depending on luck.
//
// According to measurements, this does not result in any performance loss
// (or gain), but if it becomes necessary for some reason, it should be
// possible to set asyncpreemptoff=1 only if debugging is enabled by
// plumbing that information through PrimaryBuilderInvocation just like
// --delve_path and --delve_listen.
//
// The original reason for adding async preemption to Go is here:
// https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md
Command: `cd "$$(dirname "$builder")" && ` +
`BUILDER="$$PWD/$$(basename "$builder")" && ` +
`cd / && ` +
`env -i "$$BUILDER" ` +
`env -i GODEBUG=asyncpreemptoff=1 "$$BUILDER" ` +
` --top "$$TOP" ` +
` --soong_out "$soongOutDir" ` +
` --out "$outDir" ` +