-
Notifications
You must be signed in to change notification settings - Fork 307
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
Pipe-based Context Switching - slave write failed: Broken pipe #1
Comments
Original comment by |
Original comment by |
These are probably spurious errors at the end of the timing period when there is a race for the alarm to expire and deliver SIGALRM to the process (both in parent and child, who might still be trying to write() to the other). The solution is probably to ignore SIGPIPE and not to error out if write() fails with EPIPE. |
Addresses "slave write failed: Broken pipe; aborting" There are two processes that are alternating reading and writing a sequence number of sizeof(unsigned long) size, which is 4 bytes on 32-bit ILP32 ABI and 8 bytes on 64-bit LP64 ABI. The read/write passing of incrementing sequence number occurs in infinite loop until an alarm signals each process. There is a race condition where a signal delivered to one process might close the pipes while the second process was still attempting to read or write from the pipes, and before the second process was interrupted with SIGALRM. This patch fixes the race condition that occurs at the end of the test run, after the first SIGALRM is delivered. This patch does not address the paranoid possibility that read() or write() of 4 or 8 bytes might theoretically be a partial read() or write(), but that is extremely unlikely except in the case of a signal being delivered, and the only signal expected is SIGALRM, and the processing of SIGALRM by report() function does not return. (This patch adds code to ignore SIGPIPE, so SIGALRM is the only expected signal.) github: fixes kdlucas#1
I faced the same issue several weeks ago with the newest version of UnixBench and kernel and trying to find a solution for it. After a long troubleshooting , i finally found the root cause : Solution : It works perfectly in my case , hope it can help more people. |
@introlive thanks for that note. I'll look to add some code to reset the signal for |
@introlive if you're running the latest UnixBench from this repo, it includes #39, which I committed in 2016. That patch intentionally sets Would you please provide more details including exactly what error message you receive? (Saying "same issue" is vague.) Is the program exiting early for you? I can see that the code could handle EINTR better, but the program is not expecting signals besides running as quickly as it can until it receives SIGALRM from the At the moment, assuming you are running the latest UnixBench code from this git repo, I do not see how or why "Adding |
@gstrauss Unixbench runs smoothly when i used bash every time , but randomly having "Pipe-based Context Switching - slave write failed: Broken pipe" error when running in systemd. In systemd , the default behavior is IgnoreSIGPIPE=True if we don't define it , so in my case it's mainly a systemd issue rather than unixbench's , but since the error message is exactly the same as this subject , i raised it here for reference. |
You can see SIG_IGN signal disposition should be inherited by the child process. Is that not happening for you when running under systemd? Ignoring SIGPIPE must be happening, or else the program would exit due to SIGPIPE were SIGPIPE not caught and then handled or ignored. ==> Since you are getting the error "slave write failed: Broken pipe", the program did not die due to SIGPIPE; SIGPIPE was ignored. https://github.com/kdlucas/byte-unixbench/blob/master/UnixBench/src/context1.c#L114
"Broken pipe" is EPIPE. You're getting the error "slave write failed: Broken pipe" (which is EPIPE), so Would you modify the code |
@gstrauss
After this error "slave write failed 32 != EPIPE (32)" UnixBench exited immediately and won't proceed the rest tests. |
Are you compiling UnixBench on the same exact machine on which you are running it? If not, you should. If you are not doing so, then you should modify the Try compiling with |
@gstrauss i compiled it on the same box that running it by default make command without any addition flags. |
|
@gstrauss Almost the same output but the error came out in Pass 2. ########################################################
Pipe-based Context Switching -- 2 copies
==> "/opt/UnixBench/pgms/context1" 10 2>&1 >> "/opt/UnixBench/results/ip-******.ec2.internal-2023-04-26-01.log"
#### Pass 1
# COUNT0: 1465693
# COUNT1: 1
# COUNT2: lps
# elapsed: 10.004290
# pid: 9844
# status: 0
# COUNT0: 1473294
# COUNT1: 1
# COUNT2: lps
# elapsed: 10.007370
# pid: 9845
# status: 0
#### Pass 2
# COUNT0: 1473899
# COUNT1: 1
# COUNT2: lps
# elapsed: 10.005248
# pid: 9859
# status: 0
# COUNT0: 1483661
# COUNT1: 1
# COUNT2: lps
# ERROR: slave write failed 32 != EPIPE (32)
# elapsed: 10.007729
# pid: 9860
# status: 0 |
|
Original issue reported on code.google.com by
kdlu...@gmail.com
on 3 Nov 2009 at 12:00The text was updated successfully, but these errors were encountered: