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: deletes compiled user binary too early, before it has finished executing and sending output #40902
Comments
Thanks for reporting.
Do you mind describing the fix you have in mind? What event do you think the playground should wait for before it's okay to remove the binary? |
I am thinking of simply removing the https://github.com/golang/tools/blob/cf83efe03cf89b09f33be7e464f1c95f6c3393aa/playground/socket/socket.go#L362 The cleanup process is actually done in the Removing this line should not lead to any garbage left on the filesystem. |
That seems reasonable. There's even a comment on a line below in that method: p.path = path // to be removed by p.end Thanks. I'll move this issue to NeedsFix state. |
The cleaning process is already handled by the `end` method of the `process` struct. This premature removal causes trouble on MacOS preventing the present tool to work correctly. This should fixe issue golang/go#40902
The cleaning process happens in the end method of process, after cmd.Wait. Deleting it early while the cmd is still running is causing issues for security tools. Fixes golang/go#40902
Change https://golang.org/cl/249777 mentions this issue: |
I could reproduce the issue on macOS and confirmed that CL 249777 fixes it. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am writing a slide to use with the latest version of present (188abfa).
I use the
play
capability, but when I try to run any simple code from the browser, it fails with the message:program exited: signal: killed
What did you expect to see?
The result of the program
What did you see instead?
program exited: signal: killed
Diagnostic.
I looked into MacOS log files, and it complains with:
I made a debug session, and it looks like
present
is removing the binary prematurely; therefore, MacOS is killing it.Removing this line,
https://github.com/golang/tools/blob/cf83efe03cf89b09f33be7e464f1c95f6c3393aa/playground/socket/socket.go#L362
fixes the error.
The file produced by the execution process are cleaned here https://github.com/golang/tools/blob/cf83efe03cf89b09f33be7e464f1c95f6c3393aa/playground/socket/socket.go#L207
I can submit the fix if this is ok.
EDIT, the link to the fix in socket.go was leading to the wrong line
The text was updated successfully, but these errors were encountered: