Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/playground: timeout running program but locally it works fine #57294

Open
Ghilteras opened this issue Dec 13, 2022 · 4 comments
Open

x/playground: timeout running program but locally it works fine #57294

Ghilteras opened this issue Dec 13, 2022 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@Ghilteras
Copy link

Ghilteras commented Dec 13, 2022

What version of Go are you using (go version)?

1.19 on playground

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

locally where it works fine I use this

❯ go env                                                                                                                                                                ─╯
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/path/Library/Caches/go-build"
GOENV="/Users/path/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/path/go/pkg/mod"
GOOS="darwin"
GOPATH="/Users/path/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_w/9dtgqhsj1n13jrc_tcb_98pw0000gn/T/go-build3103171944=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I run this playground https://go.dev/play/p/540B1xaqNzs

What did you expect to see?

I expect the program to run fine on Playground

What did you see instead?

Playground throws a weird timeout running program, but if I run it locally it works just fine.

@gopherbot gopherbot added this to the Unreleased milestone Dec 13, 2022
@Ghilteras Ghilteras changed the title x/Playground: x/Playground: timeout running program but locally it works fine Dec 13, 2022
@Ghilteras Ghilteras changed the title x/Playground: timeout running program but locally it works fine x/playground: timeout running program but locally it works fine Dec 13, 2022
@thanm thanm added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 14, 2022
@thanm
Copy link
Contributor

thanm commented Dec 14, 2022

@toothrot per owners.

Be advised that the playground runs program using a fake version of the time package, the idea being that if a program does a sleep for 10 seconds, we don't actually want to sleep for a real 10 seconds (that would be waste of playground resources). What this means in general is that programs that do complicated things with timers and time.Sleep calls are likely to encounter problems (as in your case here).

@Ghilteras
Copy link
Author

@thanm @toothrot I understand so how can I make this example run if I cannot timeout? I've seen other playgrounds sleeping just fine, what's the complicated thing that playground cannot handle? Does this affect the Ticker as well?

@thanm
Copy link
Contributor

thanm commented Dec 14, 2022

A little more debugging:

$ rm -f issue57294
$ go build -tags=faketime issue57294.go
$ GODEBUG=tracebackancestors=10 \
  GOTRACEBACK=all \
   ./issue57294 1> faketime.err.txt 2>&1 &
$ PID=$!
$ sleep 5
$ kill -SEGV $PID

Seems that the program actually deadlocks, as opposed to just running slowly.

@Ghilteras
Copy link
Author

Ghilteras commented Dec 14, 2022

@thanm I don't see any deadlocks locally, it compiles and runs just fine. I assume the deadlock is caused by faketime? How would I work around it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants