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
syscall: Syscall occasionally returns incorrect result #51404
Comments
https://man7.org/linux/man-pages/man2/setpriority.2.html
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only. For questions please refer to https://github.com/golang/go/wiki/Questions |
Hi @mengzhuo , thanks for the quick response. Based on your response, this is likely outside Golang scope. I don't quite understand (yet) why this happens, though. In the example,
https://linux.die.net/man/3/setpriority Also,
https://man7.org/linux/man-pages/man2/setpriority.2.html Based on this, even if the goroutine runs on a different thread, the priority should be changed, right? |
I found another indicator that this might actually be a kernel bug and not a Golang bug: When calling
https://man7.org/linux/man-pages/man2/setpriority.2.html However, in practice, when using the PID instead of 0, the program now runs indefinitely, even without Playground link: https://go.dev/play/p/iuzD-oizh7d |
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?
Compile the following program: https://go.dev/play/p/MQfIQDsSuCv
Run it as root on a Linux system.
What did you expect to see?
The program should never terminate since Getpriority will always return the priority that was set previously by Setpriority.
What did you see instead?
After a few seconds, the program terminates, stating that
Getpriority
returned an incorrect value.This does not happen if
runtime.LockOSThread
is called at the start ofmain
.Presumably, the incorrect value originates from a context switch in the runtime right after the syscall
(
strace
output seems to support that something happens at that time, but I'm not sure what exactly besides a lot offutex
syscalls).The text was updated successfully, but these errors were encountered: