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: corrupted output on long slice printing #67438

Open
pierrre opened this issue May 16, 2024 · 4 comments
Open

x/playground: corrupted output on long slice printing #67438

pierrre opened this issue May 16, 2024 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@pierrre
Copy link

pierrre commented May 16, 2024

Go version

1.22

Output of go env in your module/workspace:

playground

What did you do?

https://go.dev/play/p/1ZOjQOU_9Wz

What did you see happen?

The output contains corrupted data.
Some strange characters are printed, and the list of numbers is not displayed correctly.
The list doesn't start at the first number.

What did you expect to see?

A list of increasing numbers.

@dmitshur dmitshur changed the title playground: corrupted output on long slice printing x/playground: corrupted output on long slice printing May 16, 2024
@gopherbot gopherbot added this to the Unreleased milestone May 16, 2024
@dmitshur
Copy link
Contributor

CC @golang/tools-team.

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 16, 2024
@jfrech
Copy link

jfrech commented May 27, 2024

Fiddling with it, I've seen non-deterministic behaviour (only sometimes, the first character is the error box when depressing "Run"): https://go.dev/play/p/W-ED_UTL3FD

package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Print(strings.Repeat(".", 199681))
}

For a repeat count of 199680, no erroneous character was observed.

@jfrech
Copy link

jfrech commented May 27, 2024

Analysing network traffic (https://go.dev/_/compile?backend='s response) on a garbled play, it appears the backend sends erroneous JSON:

$ hd clipboard 
00000000  7b 22 45 72 72 6f 72 73  22 3a 22 22 2c 22 45 76  |{"Errors":"","Ev|
00000010  65 6e 74 73 22 3a 5b 7b  22 4d 65 73 73 61 67 65  |ents":[{"Message|
00000020  22 3a 22 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |":".............|
00000030  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
00010020  2e 2e 2e 5c 75 30 30 30  30 5c 75 30 30 30 30 50  |...\u0000\u0000P|
00010030  42 5c 75 30 30 31 31 74  ef bf bd ef bf bd ef bf  |B\u0011t........|
00010040  bd 5c 75 30 30 31 38 60  5c 75 30 30 30 30 5c 75  |.\u0018`\u0000\u|
00010050  30 30 30 30 5c 75 30 30  30 32 5c 66 5c 75 30 30  |0000\u0002\f\u00|
00010060  30 31 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |01..............|
00010070  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
00010c60  2e 2e 2e 5c 75 30 30 30  30 5c 75 30 30 30 30 50  |...\u0000\u0000P|
00010c70  42 5c 75 30 30 31 31 74  ef bf bd ef bf bd ef bf  |B\u0011t........|
00010c80  bd 5c 75 30 30 31 38 60  5c 75 30 30 30 30 5c 75  |.\u0018`\u0000\u|
00010c90  30 30 30 30 5c 75 30 30  30 32 5c 75 30 30 30 30  |0000\u0002\u0000|
00010ca0  5c 75 30 30 30 30 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |\u0000..........|
00010cb0  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
00016ca0  2e 2e 2e 2e 2e 2e 5c 75  30 30 30 30 5c 75 30 30  |......\u0000\u00|
00016cb0  30 30 50 42 5c 75 30 30  31 31 74 ef bf bd ef bf  |00PB\u0011t.....|
00016cc0  bd ef bf bd 5c 75 30 30  31 38 60 5c 75 30 30 30  |....\u0018`\u000|
00016cd0  30 5c 75 30 30 30 30 5c  75 30 30 30 31 ef bf bd  |0\u0000\u0001...|
00016ce0  5c 75 30 30 30 30 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |\u0000..........|
00016cf0  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
00026ce0  2e 2e 2e 2e 2e 2e 5c 75  30 30 30 30 5c 75 30 30  |......\u0000\u00|
00026cf0  30 30 50 42 5c 75 30 30  31 31 74 ef bf bd ef bf  |00PB\u0011t.....|
00026d00  bd ef bf bd 5c 75 30 30  31 38 60 5c 75 30 30 30  |....\u0018`\u000|
00026d10  30 5c 75 30 30 30 30 5c  75 30 30 30 30 ef bf bd  |0\u0000\u0000...|
00026d20  5c 75 30 30 30 30 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |\u0000..........|
00026d30  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
00028d20  2e 2e 2e 2e 2e 2e 5c 75  30 30 30 30 5c 75 30 30  |......\u0000\u00|
00028d30  30 30 50 42 5c 75 30 30  31 31 74 ef bf bd ef bf  |00PB\u0011t.....|
00028d40  bd ef bf bd 5c 75 30 30  31 38 60 5c 75 30 30 30  |....\u0018`\u000|
00028d50  30 5c 75 30 30 30 30 5c  75 30 30 30 30 ef bf bd  |0\u0000\u0000...|
00028d60  5c 75 30 30 30 30 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |\u0000..........|
00028d70  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
0002cd60  2e 2e 2e 2e 2e 2e 5c 75  30 30 30 30 5c 75 30 30  |......\u0000\u00|
0002cd70  30 30 50 42 5c 75 30 30  31 31 74 ef bf bd ef bf  |00PB\u0011t.....|
0002cd80  bd ef bf bd 5c 75 30 30  31 38 60 5c 75 30 30 30  |....\u0018`\u000|
0002cd90  30 5c 75 30 30 30 30 5c  75 30 30 30 30 40 5c 75  |0\u0000\u0000@\u|
0002cda0  30 30 30 30 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |0000............|
0002cdb0  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
0002dda0  2e 2e 2e 2e 5c 75 30 30  30 30 5c 75 30 30 30 30  |....\u0000\u0000|
0002ddb0  50 42 5c 75 30 30 31 31  74 ef bf bd ef bf bd ef  |PB\u0011t.......|
0002ddc0  bf bd 5c 75 30 30 31 38  60 5c 75 30 30 30 30 5c  |..\u0018`\u0000\|
0002ddd0  75 30 30 30 30 5c 75 30  30 30 30 30 5c 75 30 30  |u0000\u00000\u00|
0002dde0  30 30 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |00..............|
0002ddf0  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
0002ede0  2e 2e 5c 75 30 30 30 30  5c 75 30 30 30 30 50 42  |..\u0000\u0000PB|
0002edf0  5c 75 30 30 31 31 74 ef  bf bd ef bf bd ef bf bd  |\u0011t.........|
0002ee00  5c 75 30 30 31 38 60 5c  75 30 30 30 30 5c 75 30  |\u0018`\u0000\u0|
0002ee10  30 30 30 5c 75 30 30 30  30 20 5c 75 30 30 30 30  |000\u0000 \u0000|
0002ee20  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
00030e20  22 2c 22 4b 69 6e 64 22  3a 22 73 74 64 6f 75 74  |","Kind":"stdout|
00030e30  22 2c 22 44 65 6c 61 79  22 3a 30 7d 5d 2c 22 56  |","Delay":0}],"V|
00030e40  65 74 45 72 72 6f 72 73  22 3a 22 22 7d           |etErrors":""}|
00030e4d

@jfrech
Copy link

jfrech commented May 27, 2024

Buggy behaviour is only seen erratically:

$ n=65521; curl -fsSL -X POST "https://go.dev/_/compile?body=package+main%0A%0Aimport+(%0A%09%22fmt%22%0A%09%22strings%22%0A)%0A%0Afunc+main()+%7B+fmt.Print(strings.Repeat(%22_%22%2C+$n))+%7D%0A" | sed 's/__*/_/g'; echo
{"compile_errors":"","output":"_"}
$ n=65521; curl -fsSL -X POST "https://go.dev/_/compile?body=package+main%0A%0Aimport+(%0A%09%22fmt%22%0A%09%22strings%22%0A)%0A%0Afunc+main()+%7B+fmt.Print(strings.Repeat(%22_%22%2C+$n))+%7D%0A" | sed 's/__*/_/g'; echo
{"compile_errors":"","output":"_\u0000\u0000PB\u0011t���\u0018`\u0000\u0000\u0000\u000f�_"}

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

4 participants