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/tools/playground: program does not stop #41007

Closed
Teelevision opened this issue Aug 24, 2020 · 2 comments
Closed

x/tools/playground: program does not stop #41007

Teelevision opened this issue Aug 24, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@Teelevision
Copy link

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

The playground uses the latest stable release of Go.
The current version is go1.14.7.

Does this issue reproduce with the latest release?

There is as yet insufficient data for a meaningful answer.

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

That running on https://play.golang.org/.

What did you do?

https://play.golang.org/p/kQraatQeinz

package main

import (
	"fmt"
	"time"
)

func main() {
	ticker := time.NewTicker(time.Second)
	for {
		select {
		case <-ticker.C:
			fmt.Print(".")
			break
		}
	}
	fmt.Println("Hello, playground")
}

What did you expect to see?

Program not starting or program running into timeout.

What did you see instead?

Playground reports a timeout and then does not stop generating output:

./prog.go:17:2: unreachable code
Go vet exited.

timeout running program
......................................................[...]

Program is still running as of finishing writing this issue. (More than 15 minutes.)

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Aug 24, 2020
@gopherbot gopherbot added this to the Unreleased milestone Aug 24, 2020
@prattmic prattmic added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 24, 2020
@prattmic
Copy link
Member

cc @toothrot

@toothrot toothrot self-assigned this Aug 24, 2020
@toothrot
Copy link
Contributor

Hey @Teelevision, this is actually part of our faketime simulation of how the program output would look had it been running. As the clock and time advancement has been faked, we simulate delays in our output so it tries to look like what your program would have done.

If you change your code slightly to put the time output by ticker.C, the final message from your program before it was terminated would look similar to this:

# our API response:
{"Message":"2009-11-11 02:42:25 +0000 UTC m=+13345.000000001\n","Kind":"stdout","Delay":1000000000}

In this case, you can see that we weren't actually sleeping between loop iterations, and the clock has moved forward quite a lot further than our 5 second timeout! Our javascript UI simulates this in your browser, and calculates how long to sleep between each message based on the Delay field.

In any case, this is working as intended, so I will close this issue. As the output states, there was a timeout running your program, it was really killed (I verified locally and in production to be extra sure), but we fake your output so it looks real.

I hope that helps! Please comment if something isn't clear.

@golang golang locked and limited conversation to collaborators Aug 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants