javacaliper

Google Caliper: can't complete benchmark (The worker exited without producing data)


When I try to run a benchmark method with Caliper, it exits before completing any measurements. I confirmed in debugger that Caliper is executing the benchmark method twice, when it is going through its dry run phase. But when it tries to run the experiments it exits before completing anything.

The benchmark method is very simple (although it calls a lot of other application code):

@Benchmark
public int testNewOrder(int reps) {
    OrderRequest newOrder = this.newOrder;
    for (int i = 0; i < reps; i++) {
        router.getWorker().processOrderRequest(USER_CONN_ID, newOrder, System.currentTimeMillis());
        mockFixEngineManager.clear();           
    }
    return 10;
}

Running with --verbose doesn't yield any different output that I can see. The entire output is:

Experiment selection: 
  Instruments:   [allocation, runtime]
  User parameters:   {}
  Virtual machines:  [default]
  Selection type:    Full cartesian product

This selection yields 2 experiments.
Starting experiment 1 of 2: {instrument=allocation, benchmarkMethod=testNewOrder, vm=default, parameters={}}… The worker exited without producing data. It has likely crashed. Run with --verbose to see any worker output.

I am running on Windows 7, using JDK 1.7.0_40 (in case that makes a difference). I ran the Caliper code through the debugger, and I see it is exiting here:

// ExperimentingCaliperRun.java, line 384

     processFuture.addListener(new Runnable() {
        @Override public void run() {
          if (!pipeReaderFuture.isDone()) {
            // the process completed without the pipe ever being written to.  it crashed.
            // TODO(gak): get the output from the worker so we can know why it crashed
            stdout.print("The worker exited without producing data. "
                + "It has likely crashed. Run with --verbose to see any worker output.\n");
            stdout.flush();
            System.exit(1);
          }
        }
      }, MoreExecutors.sameThreadExecutor());

pipeReaderFuture.isDone() returns false. I'm not sure why. There are no errors written to stderr.


Solution

  • This was Caliper Issue #230. After I posted the failure detail, the developers were able to post a fix. To get the fix, you'll need to pull the latest from the Git repository to get the fix.