On Monday, 11 April 2022 at 09:26:28 UTC+1 scorr...@gmail.com wrote: > and the output keeps growing like that with every new curl request until > eventually it starts constantly printing output like this: > >> >> [pid 143818] 10:02:22.697120 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.707609 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.718125 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.728753 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.739195 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.749618 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.760160 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.770669 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.781137 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.791581 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.802060 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.812540 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.822981 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> [pid 143818] 10:02:22.833468 nanosleep({tv_sec=0, tv_nsec=10000000}, >> NULL) = 0 >> >> That is normal, I believe, for a process with multiple runnable goroutines - one alarm/wakeup call every 10ms.
What is odd is the 100% CPU utilisation. Can you attach an strace when that happens? As for the binary produced by "go run" - use "ps" to see where it is. For example: ==> sleepy.go <== package main import ( "sync" "time" ) func main() { var wg sync.WaitGroup wg.Add(1) go func() { time.Sleep(30 * time.Second) wg.Done() }() wg.Wait() } ==> end <== $ go run sleepy.go ... in another window ... $ ps auxwww | grep sleepy ubuntu 17743 0.0 0.1 1237424 12428 pts/1 Sl+ 11:23 0:00 go run sleepy.go ubuntu 17782 0.0 0.0 702468 1052 pts/1 Sl+ 11:23 0:00 /tmp/go-build2834561198/b001/exe/sleepy You can 'cp' it somewhere to keep it safe. If I compare this with the output of "go build sleepy.go", I see that the "go build" version is larger and unstripped: $ cp /tmp/go-build2834561198/b001/exe/sleepy sleepy-run $ file sleepy-run sleepy-run: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped $ go build sleepy.go $ file sleepy sleepy: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped Then "strip sleepy" gives me a binary which is almost, but not quite, the same size as the one from "go run". So that gives you another way to try to reproduce the problem - although if the difference is just between stripped and unstripped, then it's most likely some sort of edge timing case. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/709d99c5-82a5-4b71-b1a0-11acf5a21f6cn%40googlegroups.com.