This program, when running under go 1.14, will show a huge number of SIGURG are received even though none should be (no network IO, no explicit kills).
https://play.golang.org/p/x7hFjPZnrg5
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
func main() {
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGURG)
for {
select {
case sig := <-ch:
fmt.Printf("received %v: %s\n", sig, time.Now())
default:
_ = new(int) // generate some GC activities
}
}
}
https://go.googlesource.com/proposal/+/master/design/24543-non-cooperative-preemption.md changes to use SIGURG to preempt goroutines, which is fine, but I think os/signal.Notify should filter out those runtime generated SIGURGs.
The reason I found this is that I have a program that happens to use SIGURG as a custom signal like SIGUSR1, which works fine with previous Go releases. I understand that it should probably use SIGUSR1, but still I think os/signal should hide any signals generated by the runtime as it's irrelevant for the user and an implementation detail.
/cc @aclements thoughts?
This program, when running under go 1.14, will show a huge number of
SIGURGare received even though none should be (no network IO, no explicit kills).https://play.golang.org/p/x7hFjPZnrg5
package main import ( "fmt" "os" "os/signal" "syscall" "time" ) func main() { ch := make(chan os.Signal, 1) signal.Notify(ch, syscall.SIGURG) for { select { case sig := <-ch: fmt.Printf("received %v: %s\n", sig, time.Now()) default: _ = new(int) // generate some GC activities } } }https://go.googlesource.com/proposal/+/master/design/24543-non-cooperative-preemption.md changes to use SIGURG to preempt goroutines, which is fine, but I think
os/signal.Notifyshould filter out those runtime generated SIGURGs.The reason I found this is that I have a program that happens to use
SIGURGas a custom signal likeSIGUSR1, which works fine with previous Go releases. I understand that it should probably useSIGUSR1, but still I thinkos/signalshould hide any signals generated by the runtime as it's irrelevant for the user and an implementation detail./cc @aclements thoughts?