Here are the stack traces that I see most often. I can sometimes fail on a read and sometimes a write, suggesting it is sometimes getting beyond the first write, but I think as the pipe is buffered and asynchronous, this non-determinism is expected.
== Stream Closed on read:
All legal single inputs are accepted without error. *** FAILED ***
java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:206)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at Chisel.Tester.step(Tester.scala:93)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests.checkInOut(ChunkerTests.scala:68)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests$$anonfun$3$$anonfun$apply$mcV$sp$2.apply$mcVI$sp(ChunkerTests.scala:123)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests$$anonfun$3$$anonfun$apply$mcV$sp$2.apply(ChunkerTests.scala:123)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests$$anonfun$3$$anonfun$apply$mcV$sp$2.apply(ChunkerTests.scala:123)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
...
=== Stream closed on Write:
All illegal single inputs are recognized as errors. *** FAILED ***
java.io.IOException: Stream closed
at java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:434)
at java.io.OutputStream.write(OutputStream.java:116)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at Chisel.Tester.step(Tester.scala:90)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests.checkInOut(ChunkerTests.scala:68)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests$$anonfun$2$$anonfun$apply$mcV$sp$1.apply$mcVI$sp(ChunkerTests.scala:116)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests$$anonfun$2$$anonfun$apply$mcV$sp$1.apply(ChunkerTests.scala:116)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests$$anonfun$2$$anonfun$apply$mcV$sp$1.apply(ChunkerTests.scala:116)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
...
===
Sometimes the tests slow down significantly, I think this is caused by the heap getting progressively smaller as memory leaks.
Interesting a stack dump almost always gives me:
"ScalaTest-running-ChunkerTests" prio=10 tid=0x0000000000c5d000 nid=0xc0f waiting on condition [0x00007f3a62404000]
java.lang.Thread.State: RUNNABLE
at java.lang.Throwable.getStackTraceElement(Native Method)
at java.lang.Throwable.getOurStackTrace(Throwable.java:826)
- locked <0x00000000e4cd22d8> (a java.lang.Exception)
at java.lang.Throwable.getStackTrace(Throwable.java:815)
at java.lang.Thread.getStackTrace(Thread.java:1567)
at Chisel.Node.<init>(Node.scala:138)
at Chisel.Literal.<init>(Lit.scala:259)
at Chisel.Literal$.apply(Lit.scala:217)
at Chisel.Tester$$anonfun$step$2.apply(Tester.scala:117)
at Chisel.Tester$$anonfun$step$2.apply(Tester.scala:104)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108)
at Chisel.Tester.step(Tester.scala:104)
at com.thesett.numbers.chisel.impl.translator.rx.ChunkerTests.checkInOut(ChunkerTests.scala:68)
Suggesting this is quite an expensive call, and would probably feature highly if I did some profiling.
The stack trace is used to get a line number, for generating error reports when generating from the Chisel code.
I think perhaps it is not needed when testing? and perhaps a version of Node could be written (Node-light), that is used in the test cases.
===
I'll add some logging statements to the simulator code, see if I can figure out at what point it dies.
Rupert