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
octomarat opened this Issue Oct 3, 2018 · 10 comments

Comments

Projects
None yet
7 participants
@octomarat

octomarat commented Oct 3, 2018

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

This comment has been minimized.

Show comment
Hide comment
@pjebs

pjebs Oct 3, 2018

I can verify this.

pjebs commented Oct 3, 2018

I can verify this.

@bradfitz

This comment has been minimized.

Show comment
Hide comment
@bradfitz
Member

bradfitz commented Oct 3, 2018

@bradfitz bradfitz changed the title from play.golang.org hangs on a simple program with unreachable code to 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

This comment has been minimized.

Show comment
Hide comment
@dmitshur

dmitshur Oct 5, 2018

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@dmitshur

dmitshur Oct 5, 2018

Member

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.

Member

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 label Oct 5, 2018

@andybons

This comment has been minimized.

Show comment
Hide comment
@andybons
Member

andybons commented Oct 5, 2018

@ysmolsky

This comment has been minimized.

Show comment
Hide comment
@ysmolsky

ysmolsky Oct 5, 2018

Member

I will take a look.

Member

ysmolsky commented Oct 5, 2018

I will take a look.

@ysmolsky

This comment has been minimized.

Show comment
Hide comment
@ysmolsky

ysmolsky Oct 5, 2018

Member

@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

Member

ysmolsky 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

This comment has been minimized.

Show comment
Hide comment
@gopherbot

gopherbot Oct 5, 2018

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

gopherbot commented Oct 5, 2018

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

@bradfitz

This comment has been minimized.

Show comment
Hide comment
@bradfitz

bradfitz Oct 5, 2018

Member

Reopening until this is deployed.

Member

bradfitz commented Oct 5, 2018

Reopening until this is deployed.

@dmitshur

This comment has been minimized.

Show comment
Hide comment
@dmitshur

dmitshur Oct 5, 2018

Member

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

image

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

Member

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 Oct 5, 2018

matfax added a commit to gofunky/playground that referenced this issue Oct 8, 2018

Dockerfile: use latest x/tools containing the CL 113875
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 <dmitshur@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment