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: play.golang.org hangs on a simple program with unreachable code #27980

Closed
marat-rkh opened this issue Oct 3, 2018 · 10 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@marat-rkh
Copy link

I run this simple program on play.golang.org:

package main

func main() {
	return
	_ = "unreachable"
}

After I press "Run", the output window at the bottom of the page says "Waiting for remote server..." and nothing happens. If I run this program locally, it terminates instantly.

@pjebs
Copy link
Contributor

pjebs commented Oct 3, 2018

I can verify this.

@bradfitz
Copy link
Contributor

bradfitz commented Oct 3, 2018

/cc @andybons @dmitshur @broady

@bradfitz bradfitz changed the title play.golang.org hangs on a simple program with unreachable code x/playground: play.golang.org hangs on a simple program with unreachable code Oct 3, 2018
@gopherbot gopherbot added this to the Unreleased milestone Oct 3, 2018
@dmitshur
Copy link
Contributor

dmitshur commented Oct 5, 2018

It looks like a bug in the frontend script:

image

It seems to happen whenever there's vet output (in this case, a warning about unreachable code) and nothing is written to stdout.

@dmitshur
Copy link
Contributor

dmitshur commented Oct 5, 2018

The failing code is:

if (dataVet.Errors) {
	// inject errors from the vet as the first event in the output
	data.Events.unshift({Message: 'Go vet exited.\n\n', Kind: 'system', Delay: 0});
	data.Events.unshift({Message: dataVet.Errors, Kind: 'stderr', Delay: 0});
}

It fails when data.Events is null rather than an array.

@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 5, 2018
@andybons
Copy link
Member

andybons commented Oct 5, 2018

@ysmolsky

@ysmolski
Copy link
Member

ysmolski commented Oct 5, 2018

I will take a look.

@ysmolski
Copy link
Member

ysmolski commented Oct 5, 2018

@andybons
I do remember fixing this long time ago. It seems that playground uses old version of godoc:

# Repo golang.org/x/tools at 48418e5 (2018-05-08)
ENV REV=48418e5732e1b1e2a10207c8007a5f959e422f20
RUN go get -d golang.org/x/tools/go/ast/astutil `#and 3 other pkgs` &&\
    (cd /go/src/golang.org/x/tools && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)

And this was fixed on May 25th: https://go-review.googlesource.com/c/tools/+/113875

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/140017 mentions this issue: playground: use latest godoc with fixed playground.js

@bradfitz
Copy link
Contributor

bradfitz commented Oct 5, 2018

Reopening until this is deployed.

@dmitshur
Copy link
Contributor

dmitshur commented Oct 5, 2018

Redeployed play.golang.org, confirmed the issue is resolved:

image

(Source: https://play.golang.org/p/egwBhqHiRnk.)

@dmitshur dmitshur closed this as completed Oct 5, 2018
matfax pushed a commit to gofunky/playground that referenced this issue Oct 8, 2018
Use the godoc with the CL 113875. That CL handles the case when there
was no output from the user program and vet returned an error.

Fixes golang/go#27980

Change-Id: I8f3d5ff477fb930c099fd9780c102c8421403e55
Reviewed-on: https://go-review.googlesource.com/c/140017
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
@golang golang locked and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants