-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: TestEPIPE fails on android #18100
Comments
This is also responsible for the os/exec test failure on android, which exits with no error in TestContextCancel (which uses a pipe). |
On it. |
Here are my results so far. CL 32796 did two things: First, the Go signal handler for SIGPIPE is installed even in c-archive and c-shared mode. Second, sigfwdgo is changed to forward SIGPIPE signals to any C signal handler installed before Go. The problem is the second part, SIGPIPE forwarding. sigfwdgo contains this check:
However, it seems that (2) in the comment and check disagree: when TestEPIPE triggers a SIGPIPE through the write system call, syscallsp is not 0 because syscallsp is nonzero in both CGO and in syscalls. So sigfwdgo decides to forward the SIGPIPE because it thinks it originates from CGO. The default handler in turn ends up crashing the process. I was puzzled for a while why Android failed and other unixes didn't. The reason seems to be that the earlier check in sigfwdgo
catches the SIGPIPE early on (my) Linux, while on Android there is a non-default handler for SIGPIPE and so SIGPIPEs fall through to the syscallsp check. I'm not sure how to proceed from here. Perhaps the CGO check should be fixed to exclude syscalls from Go (if not, the (2) comment should be updated). If so, how? @ianlancetaylor ? |
Thanks for investigating. The case you mention--a signal occurring during a system call--was never a problem before we started handling Unfortunately I can't think of a way to reliably distinguish running in cgo code from running in a system call. It may be necessary to add a field like |
I suspected that much. Without ncgo or similar would you accept a CL that removed forwarding of SIGPIPE for Go 1.8? Forwarding it is most correct, but since SIGPIPE seems like a pretty useless signal I'd rather not forward them than allowing SIGPIPEs from Go to crash c-archive and c-shared programs. |
Frankly at this point my inclination is to roll back the whole change series and try again in 1.9. Failing to forward |
Very well. https://go-review.googlesource.com/c/33770 |
With the revert in, this issue should be closed. Also, could someone please re-open #17393 and mark it for Go 1.9 (or show me how to do it myself)? Thanks. |
@eliasnaur Issues adjusted. I think I added you to the appropriate github group so that you can frob issues yourself. |
At tip, TestEPIPE causes the package os test binary to immediately exit. It shows up as no output on the builder, but run locally as
go test -short -v os
:The failure is caused by the change in https://golang.org/cl/32796. (I am not sure why, but reverting it fixes the test.)
cc @ianlancetaylor
The text was updated successfully, but these errors were encountered: