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

Pipe-based Context Switching - slave write failed: Broken pipe #1

Open
GoogleCodeExporter opened this issue Apr 9, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Execute the test harness with ./Run
2. Notice that while the Pipe-based Context Switching test is running, it
fails with the error message: "slave write failed: Broken pipe; aborting"
3. This only happens on certain platforms, as I don't see this occur on all
hardware/software configurations. But I have seen it happen on certain
Ubuntu releases.

I'm currently seeing this with Ubuntu Karmic derivative with the 2.6.30
kernel, i686, running on an ASUS EEE PC with INtel Atom CPU N280 @ 1.66ghz.

Original issue reported on code.google.com by [email protected] on 3 Nov 2009 at 12:00

@GoogleCodeExporter
Copy link
Author

Did you find a solution to this problem?  I'm experiencing it too, but only 
when run from the python subprocess module.

uname:  Linux brasil 2.6.28-18-generic #60-Ubuntu SMP Fri Mar 12 04:40:52 UTC 
2010 i686 GNU/Linux
cpu: GenuineIntel Pentium(R) Dual-Core CPU       T4200  @ 2.00GHz
distro: xubuntu jaunty
python: 2.6.2

Here's a code snippet showing how I'm running it:

        p = subprocess.Popen(cmd, shell=True)
        retval = p.wait()

and cmd looks like this:

/usr/local/bench/unixbench-5.1.2/Run context1 > 
/usr/local/bench/archive/2010-06-07_08:53:55/context1.out 2> 
/usr/local/bench/archive/2010-06-07_08:53:55/context1.err

stderr looks like this:

**********************************************
Run: "Pipe-based Context Switching": slave write failed: Broken pipe; aborting



Thanks!
Jacob

Original comment by [email protected] on 7 Jun 2010 at 11:41

@GoogleCodeExporter
Copy link
Author

No, I haven't found a solution in UnixBench or in Python. So, to solve this 
issue, I implemented a work around using a java program. Here is the java 
source, and what I do is package this java code with UnixBench, and then 
compile it during the step where I compile UnixBench, and then simply call this 
java program from Python with subprocess.Popen() using a command of java 
runbench (my java file name). Just modify the String args command with how you 
want to run UnixBench, and this should work, assuming you have a java installed.

runbench.java:
==================================================
import java.io.*;
import java.util.*;


class StreamGobbler extends Thread {

  InputStream is;
  String type;

  StreamGobbler(InputStream is, String type) {
    this.is = is;
    this.type = type;
  }

  public void run() {
    try {
      InputStreamReader isr = new InputStreamReader(is);
      BufferedReader br = new BufferedReader(isr);
      String line=null;
      while((line = br.readLine()) != null)
        System.out.println(type + ">" + line);
    } catch (IOException ioe) {
        ioe.printStackTrace();
        }
  }
}

public class runbench extends Thread {

  static void runbench() {
    try {
      Runtime runtime = Runtime.getRuntime();
      String[] args = new String[] {"bash", "-c", "./Run -c 16"};
      Process p = runtime.exec(args);
      StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(), "ERROR");
      StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream(), "OUTPUT");
      errorGobbler.start();
      outputGobbler.start();
      int exitVal = p.waitFor();
      System.out.println("ExitValue: " + exitVal);
    }
  catch (Throwable t) {
    t.printStackTrace();
    }
  }

  public static void main(String[] args) throws IOException {
    runbench();
  }
}
===============================================================

Original comment by [email protected] on 7 Jun 2010 at 11:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant