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

runtime: usleep() does not work on Linux 386 #21518

Closed
pvoicu opened this issue Aug 18, 2017 · 8 comments
Closed

runtime: usleep() does not work on Linux 386 #21518

pvoicu opened this issue Aug 18, 2017 · 8 comments
Milestone

Comments

@pvoicu
Copy link
Contributor

pvoicu commented Aug 18, 2017

Please answer these questions before submitting your issue. Thanks!

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

go1.8.3 linux/386

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

GOARCH="386"
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"

What did you do?

It is internal function to the runtime package, so I cannot provide a test code to reproduce.
To reproduce, someone needs to compile any application for linux/386 and strace the second thread

What did you expect to see?

pselect6(0, NULL, NULL, NULL, {0, 20000}, 0) = 0 (Timeout)

What did you see instead?

I see pselect6(0, NULL, NULL, NULL, {0, 0}, 0) = 0 (Timeout)

runtime.usleep always sets the nanosecond parameter to 0. The fix is at line https://go.googlesource.com/go/+/master/src/runtime/sys_linux_386.s#103, it should be "MOVL AX, 4(SP)".

@ALTree
Copy link
Member

ALTree commented Aug 18, 2017

The CL that changed the linked function was not originally in go1.8, but it was cherrypicked here: https://go-review.googlesource.com/c/44002

It's also in go1.9rc2.

cc @aclements

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 18, 2017
@gopherbot
Copy link

Change https://golang.org/cl/56850 mentions this issue: runtime: fix usleep by correctly setting nanoseconds parameter for pselect6

@ALTree ALTree changed the title runtime.usleep() does not work on Linux 386 runtime: usleep() does not work on Linux 386 Aug 18, 2017
@ianlancetaylor ianlancetaylor added this to the Go1.9 milestone Aug 18, 2017
@aclements
Copy link
Member

Re-opening for cherry-pick to release branch.

@aclements aclements reopened this Aug 18, 2017
@gopherbot
Copy link

Change https://golang.org/cl/56891 mentions this issue: [release-branch.go1.9] runtime: fix usleep by correctly setting nanoseconds parameter for pselect6

@aclements aclements removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 18, 2017
@aclements
Copy link
Member

Cherry-pick to 1.8.4 is issue #21520.

Thanks for finding this @pvoicu!

gopherbot pushed a commit that referenced this issue Aug 18, 2017
…econds parameter for pselect6

Fixes #21518

Change-Id: Idd67e3f0410d0ce991b34dcc0c8f15e0d5c529c9
Reviewed-on: https://go-review.googlesource.com/56891
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Petrica Voicu <pvoicu@paypal.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@ALTree
Copy link
Member

ALTree commented Aug 18, 2017

go1.9 cherrypick was merged: http://golang.org/cl/56891, so I'm closing this.

@ALTree ALTree closed this as completed Aug 18, 2017
@tsuna
Copy link
Contributor

tsuna commented Aug 25, 2017

Thanks for fixing this bug, I was going crazy over runtime.sysmon taking up to 50% of the CPU cycles in my profiles as of late, and I thought it was something stupid we did in our own code that caused it. Today I realized the issue didn't exist in go1.8.2 and earlier, and didn't exist in go1.9 either, and traced it back to this issue.

@gopherbot
Copy link

Change https://golang.org/cl/70838 mentions this issue: [release-branch.go1.8] runtime: fix usleep by correctly setting nanoseconds parameter for pselect6

gopherbot pushed a commit that referenced this issue Oct 25, 2017
…econds parameter for pselect6

Fixes #21518

Change-Id: Idd67e3f0410d0ce991b34dcc0c8f15e0d5c529c9
Reviewed-on: https://go-review.googlesource.com/56850
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/70838
Run-TryBot: Russ Cox <rsc@golang.org>
@golang golang locked and limited conversation to collaborators Oct 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants