-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
What version of Go are you using (go version)?
1.13.3
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/user/sdk/go1.13.3"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/sdk/go1.13.3/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build069569925=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I have a very heavy load application, where I use the standard program output as logging output. This logging output is then redirected by docker towards a logserver. So far so nice.
This works perfectly, but sometimes I am missing some log lines - while the code after the print has been executed. It looks like there is an issue when two concurrent threads access the output of the application - is this intended or cannot be resolved? Maybe I am using the wrong way to output my data? I could not find anything related to that.
I've written a short example code, which seems to reproduce the problem - the same issue occurs when using fmt.println()
package main
func main() {
x := 0
for x < 1000 {
//println(x)
go myPrintFunc(x)
x++
}
println(x)
}
func myPrintFunc(i int) {
println(i)
}
What did you expect to see?
The same result as I would get with the println(i) commented in and the go-call commented out, which in my case always produces all outputs.
What did you see instead?
each time other values (which are part of the output) - I guess the first comming output blocks the other outputs.