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

ClassCastException #93

Closed
ayedo opened this Issue Jan 3, 2015 · 61 comments

Comments

Projects
None yet
3 participants
@ayedo

ayedo commented Jan 3, 2015

Hi,

First of all: thanks for your awesome work!
I run a benchmark that gets stuck. When I abort it, the following is printed to the console:

Error running separate JVM: java.lang.ClassCastException: cannot assign instance of scala.collection.immutable.HashMap$SerializationProxy to field org.scalameter.Context.properties of type scala.collection.immutable.Map in instance of org.scalameter.Context

What could the source of the problem be?

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jan 31, 2015

Member

I believe that you are maybe using outputs from two different Scalameter versions.

There is a plan to add a new persistor that is binary compatible across versions. This should be a simple task (just implement the Persistor interface, and make it a default), but I currently do not have the bandwidth. Pull requests are welcome.

Member

axel22 commented Jan 31, 2015

I believe that you are maybe using outputs from two different Scalameter versions.

There is a plan to add a new persistor that is binary compatible across versions. This should be a simple task (just implement the Persistor interface, and make it a default), but I currently do not have the bandwidth. Pull requests are welcome.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

I can confirm that I am having the same issue.

My built.sbt is pretty simple:

resolvers += "Sonatype OSS Snapshots" at
  "https://oss.sonatype.org/content/repositories/releases"

libraryDependencies += "com.storm-enroute" %% "scalameter" % "0.6"

testFrameworks += new TestFramework("org.scalameter.ScalaMeterFramework")  

logBuffered := false

parallelExecution in Test := false

scalaVersion := "2.11.6"

The problem with the ClassCastException is currently happening even on the following example:

import org.scalameter.api._

object RangeBenchmark extends PerformanceTest {

  /* configuration */

  lazy val executor = SeparateJvmsExecutor(
    new Executor.Warmer.Default,
    Aggregator.min,
    new Measurer.Default)
  lazy val reporter = new LoggingReporter
  lazy val persistor = Persistor.None

  /* inputs */

  val sizes = Gen.range("size")(300000, 1500000, 300000)

  val ranges = for {
    size <- sizes
  } yield 0 until size

  /* tests */

  performance of "Range" in {
    measure method "map" in {
      using(ranges) in {
        r => r.map(_ + 1)
      }
    }
  }

}

I would be surprised if there is some problem with different Scalameter versions, since I have specified Scala 2.11.6 in my build script. I also tried with Scala 2.10, but still got the ClassCastException.

There are no other Scala files or dependencies in my example project.

The exception does not happen if SeparateJvmsExecutor is changed to LocalExecutor, but this is not what I need.

Is there a known workaround?

andrewdbate commented Jun 22, 2015

I can confirm that I am having the same issue.

My built.sbt is pretty simple:

resolvers += "Sonatype OSS Snapshots" at
  "https://oss.sonatype.org/content/repositories/releases"

libraryDependencies += "com.storm-enroute" %% "scalameter" % "0.6"

testFrameworks += new TestFramework("org.scalameter.ScalaMeterFramework")  

logBuffered := false

parallelExecution in Test := false

scalaVersion := "2.11.6"

The problem with the ClassCastException is currently happening even on the following example:

import org.scalameter.api._

object RangeBenchmark extends PerformanceTest {

  /* configuration */

  lazy val executor = SeparateJvmsExecutor(
    new Executor.Warmer.Default,
    Aggregator.min,
    new Measurer.Default)
  lazy val reporter = new LoggingReporter
  lazy val persistor = Persistor.None

  /* inputs */

  val sizes = Gen.range("size")(300000, 1500000, 300000)

  val ranges = for {
    size <- sizes
  } yield 0 until size

  /* tests */

  performance of "Range" in {
    measure method "map" in {
      using(ranges) in {
        r => r.map(_ + 1)
      }
    }
  }

}

I would be surprised if there is some problem with different Scalameter versions, since I have specified Scala 2.11.6 in my build script. I also tried with Scala 2.10, but still got the ClassCastException.

There are no other Scala files or dependencies in my example project.

The exception does not happen if SeparateJvmsExecutor is changed to LocalExecutor, but this is not what I need.

Is there a known workaround?

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

Please print the exact error message and the stack trace, so that we can provide better feedback.

Your error is probably due to the test snippet trying to serialize the entire test object when you're running in a separate JVM.
Since SeparateJvmExecutor is not serializable, you get the exception.

The solution is to declare your members using a def instead of a val, like this:

def executor = new SeparateJvmExecutor(...)

Hope this helps.

Member

axel22 commented Jun 22, 2015

Please print the exact error message and the stack trace, so that we can provide better feedback.

Your error is probably due to the test snippet trying to serialize the entire test object when you're running in a separate JVM.
Since SeparateJvmExecutor is not serializable, you get the exception.

The solution is to declare your members using a def instead of a val, like this:

def executor = new SeparateJvmExecutor(...)

Hope this helps.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

I changed all vals to defs, but still have the same error.

For completeness the modified example is:

import org.scalameter.api._

object RangeBenchmark extends PerformanceTest {

  /* configuration */

  def executor = SeparateJvmsExecutor(
    new Executor.Warmer.Default,
    Aggregator.min,
    new Measurer.Default)
  def reporter = new LoggingReporter
  def persistor = Persistor.None

  /* inputs */

  def sizes = Gen.range("size")(300000, 1500000, 300000)

  def ranges = for {
    size <- sizes
  } yield 0 until size

  /* tests */

  performance of "Range" in {
    measure method "map" in {
      using(ranges) in {
        r => r.map(_ + 1)
      }
    }
  }

}

The SBT build script is identical to that in my last comment.

The full exception is the following:

Test threw exception: java.lang.ClassCastException: cannot assign instance of 
scala.collection.immutable.HashMap$SerializationProxy to field org.scalameter.Context.properties of 
type scala.collection.immutable.Map in instance of org.scalameter.Context
java.lang.ClassCastException: cannot assign instance of scala.collection.immutable.HashMap$SerializationProxy to field org.scalameter.Context.properties of type scala.collection.immutable.Map in instance of org.scalameter.Context
        at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2089)
        at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1261)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1999)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
        at org.scalameter.execution.JvmRunner.readOutput(JvmRunner.scala:45)
        at org.scalameter.execution.JvmRunner.run(JvmRunner.scala:18)
        at org.scalameter.execution.SeparateJvmsExecutor.sample$1(SeparateJvmsExecutor.scala:46)
        at org.scalameter.execution.SeparateJvmsExecutor.org$scalameter$execution$SeparateJvmsExecutor$$sampleReport$1(SeparateJvmsExecutor.scala:81)
        at org.scalameter.execution.SeparateJvmsExecutor$$anonfun$2.apply(SeparateJvmsExecutor.scala:95)
        at org.scalameter.execution.SeparateJvmsExecutor$$anonfun$2.apply(SeparateJvmsExecutor.scala:93)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.Iterator$class.foreach(Iterator.scala:750)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
        at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.AbstractTraversable.map(Traversable.scala:104)
        at org.scalameter.execution.SeparateJvmsExecutor.runSetup(SeparateJvmsExecutor.scala:93)
        at org.scalameter.Executor$$anonfun$run$1.apply(Executor.scala:15)
        at org.scalameter.Executor$$anonfun$run$1.apply(Executor.scala:13)
        at org.scalameter.utils.Tree$$anonfun$1.apply(Tree.scala:17)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.immutable.List.map(List.scala:285)
        at org.scalameter.utils.Tree.map(Tree.scala:17)
        at org.scalameter.utils.Tree$$anonfun$2.apply(Tree.scala:18)
        at org.scalameter.utils.Tree$$anonfun$2.apply(Tree.scala:18)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.immutable.List.map(List.scala:285)
        at org.scalameter.utils.Tree.map(Tree.scala:18)
        at org.scalameter.utils.Tree$$anonfun$2.apply(Tree.scala:18)
        at org.scalameter.utils.Tree$$anonfun$2.apply(Tree.scala:18)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.immutable.List.map(List.scala:285)
        at org.scalameter.utils.Tree.map(Tree.scala:18)
        at org.scalameter.Executor$class.run(Executor.scala:13)
        at org.scalameter.execution.SeparateJvmsExecutor.run(SeparateJvmsExecutor.scala:19)
        at org.scalameter.PerformanceTest$Initialization$class.executeTests(PerformanceTest.scala:44)
        at org.scalameter.PerformanceTest.executeTests(PerformanceTest.scala:10)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1$$anonfun$apply$1$$anonfun$apply$2.apply(ScalaMeterFramework.scala:65)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1$$anonfun$apply$1$$anonfun$apply$2.apply(ScalaMeterFramework.scala:56)
        at org.scalameter.MonadicDynVar$$anon$1$$anonfun$foreach$1.apply(MonadicDynVar.scala:7)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at org.scalameter.MonadicDynVar$$anon$1.foreach(MonadicDynVar.scala:7)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1$$anonfun$apply$1.apply(ScalaMeterFramework.scala:56)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1$$anonfun$apply$1.apply(ScalaMeterFramework.scala:55)
        at org.scalameter.MonadicDynVar$$anon$1$$anonfun$foreach$1.apply(MonadicDynVar.scala:7)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at org.scalameter.MonadicDynVar$$anon$1.foreach(MonadicDynVar.scala:7)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1.apply(ScalaMeterFramework.scala:55)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1.apply(ScalaMeterFramework.scala:54)
        at org.scalameter.MonadicDynVar$$anon$1$$anonfun$foreach$1.apply(MonadicDynVar.scala:7)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at org.scalameter.MonadicDynVar$$anon$1.foreach(MonadicDynVar.scala:7)
        at org.scalameter.ScalaMeterFramework$$anon$1.run(ScalaMeterFramework.scala:54)
        at sbt.RunnerWrapper$1.runRunner2(FrameworkWrapper.java:223)
        at sbt.RunnerWrapper$1.execute(FrameworkWrapper.java:236)
        at sbt.TestRunner.runTest$1(TestFramework.scala:76)
        at sbt.TestRunner.run(TestFramework.scala:85)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1$$anonfun$apply$8.apply(TestFramework.scala:202)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1$$anonfun$apply$8.apply(TestFramework.scala:202)
        at sbt.TestFramework$.sbt$TestFramework$$withContextLoader(TestFramework.scala:185)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1.apply(TestFramework.scala:202)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1.apply(TestFramework.scala:202)
        at sbt.TestFunction.apply(TestFramework.scala:207)
        at sbt.Tests$.sbt$Tests$$processRunnable$1(Tests.scala:239)
        at sbt.Tests$$anonfun$makeSerial$1.apply(Tests.scala:245)
        at sbt.Tests$$anonfun$makeSerial$1.apply(Tests.scala:245)
        at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:44)
        at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:44)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:235)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

I am using Java 8 update 45.

andrewdbate commented Jun 22, 2015

I changed all vals to defs, but still have the same error.

For completeness the modified example is:

import org.scalameter.api._

object RangeBenchmark extends PerformanceTest {

  /* configuration */

  def executor = SeparateJvmsExecutor(
    new Executor.Warmer.Default,
    Aggregator.min,
    new Measurer.Default)
  def reporter = new LoggingReporter
  def persistor = Persistor.None

  /* inputs */

  def sizes = Gen.range("size")(300000, 1500000, 300000)

  def ranges = for {
    size <- sizes
  } yield 0 until size

  /* tests */

  performance of "Range" in {
    measure method "map" in {
      using(ranges) in {
        r => r.map(_ + 1)
      }
    }
  }

}

The SBT build script is identical to that in my last comment.

The full exception is the following:

Test threw exception: java.lang.ClassCastException: cannot assign instance of 
scala.collection.immutable.HashMap$SerializationProxy to field org.scalameter.Context.properties of 
type scala.collection.immutable.Map in instance of org.scalameter.Context
java.lang.ClassCastException: cannot assign instance of scala.collection.immutable.HashMap$SerializationProxy to field org.scalameter.Context.properties of type scala.collection.immutable.Map in instance of org.scalameter.Context
        at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2089)
        at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1261)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1999)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
        at org.scalameter.execution.JvmRunner.readOutput(JvmRunner.scala:45)
        at org.scalameter.execution.JvmRunner.run(JvmRunner.scala:18)
        at org.scalameter.execution.SeparateJvmsExecutor.sample$1(SeparateJvmsExecutor.scala:46)
        at org.scalameter.execution.SeparateJvmsExecutor.org$scalameter$execution$SeparateJvmsExecutor$$sampleReport$1(SeparateJvmsExecutor.scala:81)
        at org.scalameter.execution.SeparateJvmsExecutor$$anonfun$2.apply(SeparateJvmsExecutor.scala:95)
        at org.scalameter.execution.SeparateJvmsExecutor$$anonfun$2.apply(SeparateJvmsExecutor.scala:93)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.Iterator$class.foreach(Iterator.scala:750)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
        at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.AbstractTraversable.map(Traversable.scala:104)
        at org.scalameter.execution.SeparateJvmsExecutor.runSetup(SeparateJvmsExecutor.scala:93)
        at org.scalameter.Executor$$anonfun$run$1.apply(Executor.scala:15)
        at org.scalameter.Executor$$anonfun$run$1.apply(Executor.scala:13)
        at org.scalameter.utils.Tree$$anonfun$1.apply(Tree.scala:17)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.immutable.List.map(List.scala:285)
        at org.scalameter.utils.Tree.map(Tree.scala:17)
        at org.scalameter.utils.Tree$$anonfun$2.apply(Tree.scala:18)
        at org.scalameter.utils.Tree$$anonfun$2.apply(Tree.scala:18)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.immutable.List.map(List.scala:285)
        at org.scalameter.utils.Tree.map(Tree.scala:18)
        at org.scalameter.utils.Tree$$anonfun$2.apply(Tree.scala:18)
        at org.scalameter.utils.Tree$$anonfun$2.apply(Tree.scala:18)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.immutable.List.map(List.scala:285)
        at org.scalameter.utils.Tree.map(Tree.scala:18)
        at org.scalameter.Executor$class.run(Executor.scala:13)
        at org.scalameter.execution.SeparateJvmsExecutor.run(SeparateJvmsExecutor.scala:19)
        at org.scalameter.PerformanceTest$Initialization$class.executeTests(PerformanceTest.scala:44)
        at org.scalameter.PerformanceTest.executeTests(PerformanceTest.scala:10)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1$$anonfun$apply$1$$anonfun$apply$2.apply(ScalaMeterFramework.scala:65)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1$$anonfun$apply$1$$anonfun$apply$2.apply(ScalaMeterFramework.scala:56)
        at org.scalameter.MonadicDynVar$$anon$1$$anonfun$foreach$1.apply(MonadicDynVar.scala:7)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at org.scalameter.MonadicDynVar$$anon$1.foreach(MonadicDynVar.scala:7)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1$$anonfun$apply$1.apply(ScalaMeterFramework.scala:56)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1$$anonfun$apply$1.apply(ScalaMeterFramework.scala:55)
        at org.scalameter.MonadicDynVar$$anon$1$$anonfun$foreach$1.apply(MonadicDynVar.scala:7)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at org.scalameter.MonadicDynVar$$anon$1.foreach(MonadicDynVar.scala:7)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1.apply(ScalaMeterFramework.scala:55)
        at org.scalameter.ScalaMeterFramework$$anon$1$$anonfun$run$1.apply(ScalaMeterFramework.scala:54)
        at org.scalameter.MonadicDynVar$$anon$1$$anonfun$foreach$1.apply(MonadicDynVar.scala:7)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at org.scalameter.MonadicDynVar$$anon$1.foreach(MonadicDynVar.scala:7)
        at org.scalameter.ScalaMeterFramework$$anon$1.run(ScalaMeterFramework.scala:54)
        at sbt.RunnerWrapper$1.runRunner2(FrameworkWrapper.java:223)
        at sbt.RunnerWrapper$1.execute(FrameworkWrapper.java:236)
        at sbt.TestRunner.runTest$1(TestFramework.scala:76)
        at sbt.TestRunner.run(TestFramework.scala:85)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1$$anonfun$apply$8.apply(TestFramework.scala:202)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1$$anonfun$apply$8.apply(TestFramework.scala:202)
        at sbt.TestFramework$.sbt$TestFramework$$withContextLoader(TestFramework.scala:185)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1.apply(TestFramework.scala:202)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1.apply(TestFramework.scala:202)
        at sbt.TestFunction.apply(TestFramework.scala:207)
        at sbt.Tests$.sbt$Tests$$processRunnable$1(Tests.scala:239)
        at sbt.Tests$$anonfun$makeSerial$1.apply(Tests.scala:245)
        at sbt.Tests$$anonfun$makeSerial$1.apply(Tests.scala:245)
        at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:44)
        at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:44)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:235)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

I am using Java 8 update 45.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

Interesting - do you have this example online somewhere to try it out?

Member

axel22 commented Jun 22, 2015

Interesting - do you have this example online somewhere to try it out?

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

I can upload this somewhere. Can you recommend the best way to do this? A mini GitHub project? Or something else?

andrewdbate commented Jun 22, 2015

I can upload this somewhere. Can you recommend the best way to do this? A mini GitHub project? Or something else?

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

I guess a GitHub project would be nice. Or you could just upload a zip with your sources, whatever is easier for you.

Member

axel22 commented Jun 22, 2015

I guess a GitHub project would be nice. Or you could just upload a zip with your sources, whatever is easier for you.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

For quickness I've put the files here.

andrewdbate commented Jun 22, 2015

For quickness I've put the files here.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

Thank you! I will dig into this now.

Member

axel22 commented Jun 22, 2015

Thank you! I will dig into this now.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

With:

$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

Everything works for me:

[info] size -> 1500000: 17.429, 17.406, 34.988, 17.503, 17.128, 17.131, 37.743, 17.457, 17.002, 17.244, 32.720, 17.636, 17.241, 17.484, 32.792, 17.709, 17.835, 17.177, 39.393, 17.758, 17.339, 16.949, 33.166, 17.574, 17.009, 17.024, 32.244, 17.478, 16.485, 16.792, 32.106, 17.375, 16.643, 16.857, 32.518, 17.114
[info] ::Benchmark Range.map::
[info] cores: 4
[info] hostname: phoenix
[info] jvm-name: Java HotSpot(TM) 64-Bit Server VM
[info] jvm-vendor: Oracle Corporation
[info] jvm-version: 23.21-b01
[info] os-arch: amd64
[info] os-name: Windows 7
[info] Parameters(size -> 300000): 3.348301
[info] Parameters(size -> 600000): 6.737738
[info] Parameters(size -> 900000): 10.067791
[info] Parameters(size -> 1200000): 13.516919
[info] Parameters(size -> 1500000): 16.485421
[info]
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
Member

axel22 commented Jun 22, 2015

With:

$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

Everything works for me:

[info] size -> 1500000: 17.429, 17.406, 34.988, 17.503, 17.128, 17.131, 37.743, 17.457, 17.002, 17.244, 32.720, 17.636, 17.241, 17.484, 32.792, 17.709, 17.835, 17.177, 39.393, 17.758, 17.339, 16.949, 33.166, 17.574, 17.009, 17.024, 32.244, 17.478, 16.485, 16.792, 32.106, 17.375, 16.643, 16.857, 32.518, 17.114
[info] ::Benchmark Range.map::
[info] cores: 4
[info] hostname: phoenix
[info] jvm-name: Java HotSpot(TM) 64-Bit Server VM
[info] jvm-vendor: Oracle Corporation
[info] jvm-version: 23.21-b01
[info] os-arch: amd64
[info] os-name: Windows 7
[info] Parameters(size -> 300000): 3.348301
[info] Parameters(size -> 600000): 6.737738
[info] Parameters(size -> 900000): 10.067791
[info] Parameters(size -> 1200000): 13.516919
[info] Parameters(size -> 1500000): 16.485421
[info]
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

I will try with Java 8.
Note that Scala 2.11 has only experimental support for Java 8.

Member

axel22 commented Jun 22, 2015

I will try with Java 8.
Note that Scala 2.11 has only experimental support for Java 8.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

I just tried this on a Linux box with JDK 8:

[info] ::Benchmark Range.map::
[info] cores: 8
[info] hostname: chara
[info] jvm-name: Java HotSpot(TM) 64-Bit Server VM
[info] jvm-vendor: Oracle Corporation
[info] jvm-version: 25.45-b02
[info] os-arch: amd64
[info] os-name: Linux
[info] Parameters(size -> 300000): 5.35899
[info] Parameters(size -> 600000): 11.157856
[info] Parameters(size -> 900000): 16.7349
[info] Parameters(size -> 1200000): 22.316086
[info] Parameters(size -> 1500000): 27.635427
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[success] Total time: 28 s, completed Jun 22, 2015 8:58:57 PM

The thing is apparently not JDK8-related.

It seems that in your case the classpath could be somehow incorrectly picked up.
Could you try adding this just before the map call in your snippet:

println(org.scalameter.utils.ClassPath.default)

So that you have:

performance of "Range" in {
  measure method "map" in {
    using(ranges) in {
      r =>
      println(org.scalameter.utils.ClassPath.default)
      r.map(_ + 1)
    }
  }
}

And then run the test to see if the classpath contains the correct values (should somehow contain the Scala library).

Member

axel22 commented Jun 22, 2015

I just tried this on a Linux box with JDK 8:

[info] ::Benchmark Range.map::
[info] cores: 8
[info] hostname: chara
[info] jvm-name: Java HotSpot(TM) 64-Bit Server VM
[info] jvm-vendor: Oracle Corporation
[info] jvm-version: 25.45-b02
[info] os-arch: amd64
[info] os-name: Linux
[info] Parameters(size -> 300000): 5.35899
[info] Parameters(size -> 600000): 11.157856
[info] Parameters(size -> 900000): 16.7349
[info] Parameters(size -> 1200000): 22.316086
[info] Parameters(size -> 1500000): 27.635427
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[success] Total time: 28 s, completed Jun 22, 2015 8:58:57 PM

The thing is apparently not JDK8-related.

It seems that in your case the classpath could be somehow incorrectly picked up.
Could you try adding this just before the map call in your snippet:

println(org.scalameter.utils.ClassPath.default)

So that you have:

performance of "Range" in {
  measure method "map" in {
    using(ranges) in {
      r =>
      println(org.scalameter.utils.ClassPath.default)
      r.map(_ + 1)
    }
  }
}

And then run the test to see if the classpath contains the correct values (should somehow contain the Scala library).

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

Btw, are you running this example through SBT?

Member

axel22 commented Jun 22, 2015

Btw, are you running this example through SBT?

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

The classpath contains the following:

~/scala-meter-issue-93/target/scala-2.11/test-classes/
~/scala-meter-issue-93/target/scala-2.11/classes
~/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar
~/.ivy2/cache/com.storm-enroute/scalameter_2.11/jars/scalameter_2.11-0.6.jar
~/.ivy2/cache/com.storm-enroute/scalameter-core_2.11/jars/scalameter-core_2.11-0.6.jar
~/.ivy2/cache/org.apache.commons/commons-math3/jars/commons-math3-3.2.jar
~/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.0.jar
~/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.1.jar
~/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.11/bundles/scala-parser-combinators_2.11-1.0.1.jar
~/.ivy2/cache/com.github.wookietreiber/scala-chart_2.11/jars/scala-chart_2.11-0.4.2.jar
~/.ivy2/cache/org.jfree/jfreechart/jars/jfreechart-1.0.17.jar
~/.ivy2/cache/org.jfree/jcommon/jars/jcommon-1.0.21.jar
~/.ivy2/cache/xml-apis/xml-apis/jars/xml-apis-1.3.04.jar
~/.ivy2/cache/org.scala-lang.modules/scala-swing_2.11/bundles/scala-swing_2.11-1.0.1.jar
~/.ivy2/cache/org.scala-tools.testing/test-interface/jars/test-interface-0.5.jar

andrewdbate commented Jun 22, 2015

The classpath contains the following:

~/scala-meter-issue-93/target/scala-2.11/test-classes/
~/scala-meter-issue-93/target/scala-2.11/classes
~/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar
~/.ivy2/cache/com.storm-enroute/scalameter_2.11/jars/scalameter_2.11-0.6.jar
~/.ivy2/cache/com.storm-enroute/scalameter-core_2.11/jars/scalameter-core_2.11-0.6.jar
~/.ivy2/cache/org.apache.commons/commons-math3/jars/commons-math3-3.2.jar
~/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.0.jar
~/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.1.jar
~/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.11/bundles/scala-parser-combinators_2.11-1.0.1.jar
~/.ivy2/cache/com.github.wookietreiber/scala-chart_2.11/jars/scala-chart_2.11-0.4.2.jar
~/.ivy2/cache/org.jfree/jfreechart/jars/jfreechart-1.0.17.jar
~/.ivy2/cache/org.jfree/jcommon/jars/jcommon-1.0.21.jar
~/.ivy2/cache/xml-apis/xml-apis/jars/xml-apis-1.3.04.jar
~/.ivy2/cache/org.scala-lang.modules/scala-swing_2.11/bundles/scala-swing_2.11-1.0.1.jar
~/.ivy2/cache/org.scala-tools.testing/test-interface/jars/test-interface-0.5.jar
@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

And yes, I am running the example through SBT using the test command on the root project.

andrewdbate commented Jun 22, 2015

And yes, I am running the example through SBT using the test command on the root project.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

Could you run the same println command from within the console in SBT?

Member

axel22 commented Jun 22, 2015

Could you run the same println command from within the console in SBT?

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

When running the same println from console within SBT:

~/scala-meter-issue-93/target/scala-2.11/classes
~/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar
~/.ivy2/cache/com.storm-enroute/scalameter_2.11/jars/scalameter_2.11-0.6.jar
~/.ivy2/cache/com.storm-enroute/scalameter-core_2.11/jars/scalameter-core_2.11-0.6.jar
~/.ivy2/cache/org.apache.commons/commons-math3/jars/commons-math3-3.2.jar
~/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.0.jar
~/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.1.jar
~/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.11/bundles/scala-parser-combinators_2.11-1.0.1.jar
~/.ivy2/cache/com.github.wookietreiber/scala-chart_2.11/jars/scala-chart_2.11-0.4.2.jar
~/.ivy2/cache/org.jfree/jfreechart/jars/jfreechart-1.0.17.jar
~/.ivy2/cache/org.jfree/jcommon/jars/jcommon-1.0.21.jar
~/.ivy2/cache/xml-apis/xml-apis/jars/xml-apis-1.3.04.jar
~/.ivy2/cache/org.scala-lang.modules/scala-swing_2.11/bundles/scala-swing_2.11-1.0.1.jar
~/.ivy2/cache/org.scala-tools.testing/test-interface/jars/test-interface-0.5.jar
~/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.11.6.jar
~/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.6.jar
~/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.3.jar
~/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.11/bundles/scala-parser-combinators_2.11-1.0.3.jar
~/.ivy2/cache/jline/jline/jars/jline-2.12.1.jar

andrewdbate commented Jun 22, 2015

When running the same println from console within SBT:

~/scala-meter-issue-93/target/scala-2.11/classes
~/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar
~/.ivy2/cache/com.storm-enroute/scalameter_2.11/jars/scalameter_2.11-0.6.jar
~/.ivy2/cache/com.storm-enroute/scalameter-core_2.11/jars/scalameter-core_2.11-0.6.jar
~/.ivy2/cache/org.apache.commons/commons-math3/jars/commons-math3-3.2.jar
~/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.0.jar
~/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.1.jar
~/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.11/bundles/scala-parser-combinators_2.11-1.0.1.jar
~/.ivy2/cache/com.github.wookietreiber/scala-chart_2.11/jars/scala-chart_2.11-0.4.2.jar
~/.ivy2/cache/org.jfree/jfreechart/jars/jfreechart-1.0.17.jar
~/.ivy2/cache/org.jfree/jcommon/jars/jcommon-1.0.21.jar
~/.ivy2/cache/xml-apis/xml-apis/jars/xml-apis-1.3.04.jar
~/.ivy2/cache/org.scala-lang.modules/scala-swing_2.11/bundles/scala-swing_2.11-1.0.1.jar
~/.ivy2/cache/org.scala-tools.testing/test-interface/jars/test-interface-0.5.jar
~/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.11.6.jar
~/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.6.jar
~/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.3.jar
~/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.11/bundles/scala-parser-combinators_2.11-1.0.3.jar
~/.ivy2/cache/jline/jline/jars/jline-2.12.1.jar
@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

At the moment, I am unable to deduce what is causing this error.
It looks like it might be a classloader issue, where a classloader somehow cannot match a serialization proxy to a class that it has on the classpath, but can't tell for sure.

Could you try doing this in build.sbt:

fork in test := true
Member

axel22 commented Jun 22, 2015

At the moment, I am unable to deduce what is causing this error.
It looks like it might be a classloader issue, where a classloader somehow cannot match a serialization proxy to a class that it has on the classpath, but can't tell for sure.

Could you try doing this in build.sbt:

fork in test := true
@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

I think I've found the problem: It works on Linux, but it doesn't work on Windows. Everything I ran above was run on Windows 7 Enterprise x64. I just downloaded the zip that I linked to from this thread, compiled and ran the test on Fedora 20, and it worked just fine.

andrewdbate commented Jun 22, 2015

I think I've found the problem: It works on Linux, but it doesn't work on Windows. Everything I ran above was run on Windows 7 Enterprise x64. I just downloaded the zip that I linked to from this thread, compiled and ran the test on Fedora 20, and it worked just fine.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

Might be the reason, still - I ran the with JDK7 on Windows 7, and with JDK8 on Ubuntu, and both worked for me.
And fork in test := true in Windows did not change anything?

Member

axel22 commented Jun 22, 2015

Might be the reason, still - I ran the with JDK7 on Windows 7, and with JDK8 on Ubuntu, and both worked for me.
And fork in test := true in Windows did not change anything?

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

I've just done that, adding fork in test := true on my Windows 7 machine with Java 8 update 45, and I get exactly the same exception as before.

andrewdbate commented Jun 22, 2015

I've just done that, adding fork in test := true on my Windows 7 machine with Java 8 update 45, and I get exactly the same exception as before.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 22, 2015

Member

I see. Unfortunately, I cannot say what is the problem.
A quick search on Google reveals a similar problem on the akka-user mailing list, and in Apache Spark. Discussions are, however, inconclusive.

Member

axel22 commented Jun 22, 2015

I see. Unfortunately, I cannot say what is the problem.
A quick search on Google reveals a similar problem on the akka-user mailing list, and in Apache Spark. Discussions are, however, inconclusive.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

I'll try on another Windows machine later and report back if there is anything new.
Interestingly, the reporter of the issue you linked to claims to be using Java 7 update 51, which if true suggests that it is not a Java 7 vs 8 issue.

andrewdbate commented Jun 22, 2015

I'll try on another Windows machine later and report back if there is anything new.
Interestingly, the reporter of the issue you linked to claims to be using Java 7 update 51, which if true suggests that it is not a Java 7 vs 8 issue.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 22, 2015

I've just tried on another Windows machine (Windows 7 Professional x64 with Java 8 update 31) and I have exactly the same problem. If I find time, I'll try with Windows 7 and Java 7 this time.

andrewdbate commented Jun 22, 2015

I've just tried on another Windows machine (Windows 7 Professional x64 with Java 8 update 31) and I have exactly the same problem. If I find time, I'll try with Windows 7 and Java 7 this time.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 24, 2015

I can confirm that on a clean installation of Windows 7 Enterprise x64 with Java 8 update 45 (the latest available minor version of Java 8 as of writing), and running the same example, the exact same bug occurs.

andrewdbate commented Jun 24, 2015

I can confirm that on a clean installation of Windows 7 Enterprise x64 with Java 8 update 45 (the latest available minor version of Java 8 as of writing), and running the same example, the exact same bug occurs.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 24, 2015

I now tried again, on yet another clean installation of Windows 7 Enterprise x64 with Java 7 update 80 (the last available version of Java 7 at the time of writing), and I still get the same bug.
@axel22 You said that you tried on Windows 7 with Java 7. Which minor version did you use?

andrewdbate commented Jun 24, 2015

I now tried again, on yet another clean installation of Windows 7 Enterprise x64 with Java 7 update 80 (the last available version of Java 7 at the time of writing), and I still get the same bug.
@axel22 You said that you tried on Windows 7 with Java 7. Which minor version did you use?

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 24, 2015

Member

I used:

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

I will try with a different Java version to check.

Member

axel22 commented Jun 24, 2015

I used:

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

I will try with a different Java version to check.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 24, 2015

I just tried on yet another clean installation of Windows 7 Enterprise x64 with Java 7 update 21, and I still get the same error as before.

$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

andrewdbate commented Jun 24, 2015

I just tried on yet another clean installation of Windows 7 Enterprise x64 with Java 7 update 21, and I still get the same error as before.

$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 24, 2015

Just to be absolutely clear about the tests that I ran: I used a clean installation of Windows 7 Enterprise x64 with all updates installed inside virtual machine, with no other software installed, and then downloaded the particular version of the JDK from oracle.com and SBT 0.13.8 (using the Windows MSI version). I then downloaded the zip file that I linked from this thread and ran sbt from the root directory of the SBT project to launch the REPL. I then ran test:compile (which always completed successfully) and then test (which lead to the error in each case).

andrewdbate commented Jun 24, 2015

Just to be absolutely clear about the tests that I ran: I used a clean installation of Windows 7 Enterprise x64 with all updates installed inside virtual machine, with no other software installed, and then downloaded the particular version of the JDK from oracle.com and SBT 0.13.8 (using the Windows MSI version). I then downloaded the zip file that I linked from this thread and ran sbt from the root directory of the SBT project to launch the REPL. I then ran test:compile (which always completed successfully) and then test (which lead to the error in each case).

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 24, 2015

Member

I see. For a moment there I thought that SBT 0.13.8 is the issue, but I think I know what your problem is.

It seems like you might be running a different Java version for SBT and for the separate JVM that ScalaMeter starts. This could happen if the java.exe is not available in your PATH variable. I was able to reproduce your problem by:

  1. running (in Cygwin):

    $ which java
    /cygdrive/c/Program Files/Java/jdk1.7.0_21/bin/java
    
  2. renaming c:/Program Files/Java/jdk1.7.0_21/bin/java.exe to c:/Program Files/Java/jdk1.7.0_21/bin/java1.exe.

  3. In Cygwin:

    $ which java
    /cygdrive/c/Windows/system32/java
    
  4. running SBT:

    $ sbt
    
  5. In SBT:

    > test
    java.lang.ClassCastException: cannot assign instance of scala.collection.immutable.HashMap$SerializationProxy to field org.scalameter.Context.properties of type scala.collection.immutable.Map in instance of org.scalameter.Context
    

Renaming my java1.exe back to java.exe seems to resolve the problem.
Can you confirm that this is what's causing the issue?

(btw, thanks for the persistence in helping to track this down)

Member

axel22 commented Jun 24, 2015

I see. For a moment there I thought that SBT 0.13.8 is the issue, but I think I know what your problem is.

It seems like you might be running a different Java version for SBT and for the separate JVM that ScalaMeter starts. This could happen if the java.exe is not available in your PATH variable. I was able to reproduce your problem by:

  1. running (in Cygwin):

    $ which java
    /cygdrive/c/Program Files/Java/jdk1.7.0_21/bin/java
    
  2. renaming c:/Program Files/Java/jdk1.7.0_21/bin/java.exe to c:/Program Files/Java/jdk1.7.0_21/bin/java1.exe.

  3. In Cygwin:

    $ which java
    /cygdrive/c/Windows/system32/java
    
  4. running SBT:

    $ sbt
    
  5. In SBT:

    > test
    java.lang.ClassCastException: cannot assign instance of scala.collection.immutable.HashMap$SerializationProxy to field org.scalameter.Context.properties of type scala.collection.immutable.Map in instance of org.scalameter.Context
    

Renaming my java1.exe back to java.exe seems to resolve the problem.
Can you confirm that this is what's causing the issue?

(btw, thanks for the persistence in helping to track this down)

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 25, 2015

Member

The classpath is not correctly specified. It looks like there is a leading slash in every classpath entry.

Could you try overriding the Key.classpath key in the config part of your test? You should set it to something like:

utils.ClassPath.default.split(";").map(_.tail).mkString("", ";", "")
Member

axel22 commented Jun 25, 2015

The classpath is not correctly specified. It looks like there is a leading slash in every classpath entry.

Could you try overriding the Key.classpath key in the config part of your test? You should set it to something like:

utils.ClassPath.default.split(";").map(_.tail).mkString("", ";", "")
@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 25, 2015

How do I do this? I guess that I need to add the line

org.scalameter.utils.ClassPath.default.split(";").map(_.tail).mkString("", ";", "")

somewhere.... but where?

andrewdbate commented Jun 25, 2015

How do I do this? I guess that I need to add the line

org.scalameter.utils.ClassPath.default.split(";").map(_.tail).mkString("", ";", "")

somewhere.... but where?

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 25, 2015

Member

Sorry, I suggested this, and I thought it would work, but it doesn't:

performance of "Range" config (
  org.scalameter.Key.classpath -> org.scalameter.utils.ClassPath.default.split(";").map(_.tail).mkString("", ";", "")
) in {
  measure method "map" in {
    using(ranges) in {
      r =>
      r.map(_ + 1)
    }
  }
}

Instead, please try this. First, in the test file, name your package org.scalameter:

package org.scalameter

Next, replace your test snippet (performance block) with the following:

val ctx = org.scalameter.dyn.currentContext.value
org.scalameter.dyn.currentContext.withValue(ctx +
  (org.scalameter.Key.classpath -> org.scalameter.utils.ClassPath.default.split(";").map(_.tail).mkString("", ";", ""))) {
  println("MODIFIED!!! " + org.scalameter.dyn.currentContext.value.goe(org.scalameter.Key.classpath, ""))
  performance of "Range" in {
    measure method "map" in {
      using(ranges) in {
        r =>
        r.map(_ + 1)
      }
    }
  }
}

For me, this replaces the classpath in the test by killing the leading slash (/) in all classpath entries.
If for some reason your JVM is interpreting classpaths differently than mine, this should fix it.

Member

axel22 commented Jun 25, 2015

Sorry, I suggested this, and I thought it would work, but it doesn't:

performance of "Range" config (
  org.scalameter.Key.classpath -> org.scalameter.utils.ClassPath.default.split(";").map(_.tail).mkString("", ";", "")
) in {
  measure method "map" in {
    using(ranges) in {
      r =>
      r.map(_ + 1)
    }
  }
}

Instead, please try this. First, in the test file, name your package org.scalameter:

package org.scalameter

Next, replace your test snippet (performance block) with the following:

val ctx = org.scalameter.dyn.currentContext.value
org.scalameter.dyn.currentContext.withValue(ctx +
  (org.scalameter.Key.classpath -> org.scalameter.utils.ClassPath.default.split(";").map(_.tail).mkString("", ";", ""))) {
  println("MODIFIED!!! " + org.scalameter.dyn.currentContext.value.goe(org.scalameter.Key.classpath, ""))
  performance of "Range" in {
    measure method "map" in {
      using(ranges) in {
        r =>
        r.map(_ + 1)
      }
    }
  }
}

For me, this replaces the classpath in the test by killing the leading slash (/) in all classpath entries.
If for some reason your JVM is interpreting classpaths differently than mine, this should fix it.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 26, 2015

It still doesn't quite work, but I'm now in a position to debug what is going on.
@axel22 Two questions: (1) Does your Windows username have a space in it? (2) Can you post the info line beginning

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m ...

that shows the classpath passed as argument to the forked JVM, please?

andrewdbate commented Jun 26, 2015

It still doesn't quite work, but I'm now in a position to debug what is going on.
@axel22 Two questions: (1) Does your Windows username have a space in it? (2) Can you post the info line beginning

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m ...

that shows the classpath passed as argument to the forked JVM, please?

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 26, 2015

I think I've finally fixed it! The problem was not with the leading slash /, the problem was with the fact that my Windows username contained a space (as is pretty common on Windows), and hence my user profile directory in C:\Users\ contained a space.

In my case, my home directory was C:\Users\Andrew Bate\, and this is what caused the problem. If the example is run for a user whose user name does not contain a space, then it works.

If you look at my comment from 2 days ago, you can see that the classpath has percent encoding of spaces, which is wrong:

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m -XX:CompileThreshold=100 -cp /C:/Users/Andrew%20Bate/Downloads/scala-meter-issue
-93/target/scala-2.11/test-classes/;/C:/Users/Andrew%20Bate/Downloads/scala-meter-issue-93/target/scala-2.11/classes;/C:/Users/Andrew%20Bate/.ivy2/cac
he/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar;/C:/Users/Andrew%20Bate/.ivy2/cache/com.storm-enroute/scalameter_2.11/jars/scalameter_2.
11-0.6.jar;  
.......

Therefore, one hack that fixes the problem is to replace %20 with a space in the classpath string, and to enclose the entire classpath in double quotes.

The full working example that implements this temporary workaround is the following:

package org.scalameter

import org.scalameter.api._

object RangeBenchmark extends PerformanceTest {

  /* configuration */

  override def executor = SeparateJvmsExecutor(
    new Executor.Warmer.Default,
    Aggregator.min,
    new Measurer.Default)
  override def reporter = new LoggingReporter
  override def persistor = Persistor.None

  /* inputs */

  def sizes = Gen.range("size")(300000, 1500000, 300000)

  def ranges = for {
    size <- sizes
  } yield 0 until size

  /* tests */

  val ctx = org.scalameter.dyn.currentContext.value
  org.scalameter.dyn.currentContext.withValue(ctx +
    (org.scalameter.Key.classpath -> org.scalameter.utils.ClassPath.default.split(";").mkString("\"", ";", "\"").replace("%20"," "))) {
    println("MODIFIED!!! " + org.scalameter.dyn.currentContext.value.goe(org.scalameter.Key.classpath, ""))
    performance of "Range" in {
      measure method "map" in {
        using(ranges) in {
          r =>
          r.map(_ + 1)
        }
      }
    }
  }

}

Hence the implementation as-is is not guaranteed to work on Windows machines when some directory on the classpath contains a space.

The proper fix would likely require that that the URIs on the classpath are URL decoded (i.e. they do not contain percent encoding of spaces, and possibly other things in cases I haven't thought of), and that the full classpath is passed using quotes.

For example

"\"" + java.net.URLDecoder.decode("C:/Users/Joe%20Bloggs/") + "\""

is likely to be more reliable than

"\"" + "C:/Users/Joe%20Bloggs/".replace("%20", " ") + "\""

since it covers other cases that might also arise.

Passing the classpath in quotes works in both Command Prompt and cygwin on Windows.

The double quotes should not be added around the classpath if the example is run on *nix.

Now that we know what needs to be fixed, would it be possible to fix the code? Many thanks.

andrewdbate commented Jun 26, 2015

I think I've finally fixed it! The problem was not with the leading slash /, the problem was with the fact that my Windows username contained a space (as is pretty common on Windows), and hence my user profile directory in C:\Users\ contained a space.

In my case, my home directory was C:\Users\Andrew Bate\, and this is what caused the problem. If the example is run for a user whose user name does not contain a space, then it works.

If you look at my comment from 2 days ago, you can see that the classpath has percent encoding of spaces, which is wrong:

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m -XX:CompileThreshold=100 -cp /C:/Users/Andrew%20Bate/Downloads/scala-meter-issue
-93/target/scala-2.11/test-classes/;/C:/Users/Andrew%20Bate/Downloads/scala-meter-issue-93/target/scala-2.11/classes;/C:/Users/Andrew%20Bate/.ivy2/cac
he/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar;/C:/Users/Andrew%20Bate/.ivy2/cache/com.storm-enroute/scalameter_2.11/jars/scalameter_2.
11-0.6.jar;  
.......

Therefore, one hack that fixes the problem is to replace %20 with a space in the classpath string, and to enclose the entire classpath in double quotes.

The full working example that implements this temporary workaround is the following:

package org.scalameter

import org.scalameter.api._

object RangeBenchmark extends PerformanceTest {

  /* configuration */

  override def executor = SeparateJvmsExecutor(
    new Executor.Warmer.Default,
    Aggregator.min,
    new Measurer.Default)
  override def reporter = new LoggingReporter
  override def persistor = Persistor.None

  /* inputs */

  def sizes = Gen.range("size")(300000, 1500000, 300000)

  def ranges = for {
    size <- sizes
  } yield 0 until size

  /* tests */

  val ctx = org.scalameter.dyn.currentContext.value
  org.scalameter.dyn.currentContext.withValue(ctx +
    (org.scalameter.Key.classpath -> org.scalameter.utils.ClassPath.default.split(";").mkString("\"", ";", "\"").replace("%20"," "))) {
    println("MODIFIED!!! " + org.scalameter.dyn.currentContext.value.goe(org.scalameter.Key.classpath, ""))
    performance of "Range" in {
      measure method "map" in {
        using(ranges) in {
          r =>
          r.map(_ + 1)
        }
      }
    }
  }

}

Hence the implementation as-is is not guaranteed to work on Windows machines when some directory on the classpath contains a space.

The proper fix would likely require that that the URIs on the classpath are URL decoded (i.e. they do not contain percent encoding of spaces, and possibly other things in cases I haven't thought of), and that the full classpath is passed using quotes.

For example

"\"" + java.net.URLDecoder.decode("C:/Users/Joe%20Bloggs/") + "\""

is likely to be more reliable than

"\"" + "C:/Users/Joe%20Bloggs/".replace("%20", " ") + "\""

since it covers other cases that might also arise.

Passing the classpath in quotes works in both Command Prompt and cygwin on Windows.

The double quotes should not be added around the classpath if the example is run on *nix.

Now that we know what needs to be fixed, would it be possible to fix the code? Many thanks.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 26, 2015

Member

Nice catch, and thanks for looking into this!
I can fix this today/tomorrow - the 0.7-SNAPSHOT will soon resolve this issue.

On June 26, 2015 6:19:49 PM GMT+02:00, Andrew D Bate notifications@github.com wrote:

I think I've finally fixed it! The problem was not with the leading
slash /, the problem was with the fact that my Windows username
contained a space (as is pretty common on Windows), and hence my user
profile directory in C:\Users\ contained a space.

In my case, my home directory was C:\Users\Andrew Bate\, and this is
what caused the problem. If the example is run for a user whose user
name does not contain a space, then it works.

If you look at my comment from 2 days ago, you can see that the
classpath has percent encoding of spaces, which is wrong:

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m
-XX:CompileThreshold=100 -cp
/C:/Users/Andrew%20Bate/Downloads/scala-meter-issue
-93/target/scala-2.11/test-classes/;/C:/Users/Andrew%20Bate/Downloads/scala-meter-issue-93/target/scala-2.11/classes;/C:/Users/Andrew%20Bate/.ivy2/cac
he/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar;/C:/Users/Andrew%20Bate/.ivy2/cache/com.storm-enroute/scalameter_2.11/jars/scalameter_2.
11-0.6.jar;  
.......

Therefore, one hack that fixes the problem is to replace %20 with a
space in the classpath string, and to enclose the entire classpath in
double quotes.

The full working example that implements this temporary workaround is
the following:

package org.scalameter

import org.scalameter.api._

object RangeBenchmark extends PerformanceTest {

 /* configuration */

 override def executor = SeparateJvmsExecutor(
   new Executor.Warmer.Default,
   Aggregator.min,
   new Measurer.Default)
 override def reporter = new LoggingReporter
 override def persistor = Persistor.None

 /* inputs */

 def sizes = Gen.range("size")(300000, 1500000, 300000)

 def ranges = for {
   size <- sizes
 } yield 0 until size

 /* tests */

 val ctx = org.scalameter.dyn.currentContext.value
 org.scalameter.dyn.currentContext.withValue(ctx +
(org.scalameter.Key.classpath ->
org.scalameter.utils.ClassPath.default.split(";").mkString("\"", ";",
"\"").replace("%20"," "))) {
println("MODIFIED!!! " +
org.scalameter.dyn.currentContext.value.goe(org.scalameter.Key.classpath,
""))
   performance of "Range" in {
     measure method "map" in {
       using(ranges) in {
         r =>
         r.map(_ + 1)
       }
     }
   }
 }

}

Hence the implementation as-is is not guaranteed to work on Windows
machines when some directory on the classpath contains a space.

The proper fix would likely require that that the URIs on the classpath
are URL decoded (i.e. they do not contain percent encoding of spaces,
and possibly other things in cases I haven't thought of), and that the
full classpath is passed using quotes.

For example

"\"" + java.net.URLDecoder.decode("C:/Users/Joe%20Bloggs/") + "\""

is likely to be more reliable than

"\"" + "C:/Users/Joe%20Bloggs/".replace("%20", " ") + "\""

since it covers other cases that might also arise.

Passing the classpath in quotes works in both Command Prompt and cygwin
on Windows.

The double quotes should not be added around the classpath if the
example is run on *nix.

Now that we know what needs to be fixed, would it be possible to fix
the code? Many thanks.


Reply to this email directly or view it on GitHub:
#93 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

Member

axel22 commented Jun 26, 2015

Nice catch, and thanks for looking into this!
I can fix this today/tomorrow - the 0.7-SNAPSHOT will soon resolve this issue.

On June 26, 2015 6:19:49 PM GMT+02:00, Andrew D Bate notifications@github.com wrote:

I think I've finally fixed it! The problem was not with the leading
slash /, the problem was with the fact that my Windows username
contained a space (as is pretty common on Windows), and hence my user
profile directory in C:\Users\ contained a space.

In my case, my home directory was C:\Users\Andrew Bate\, and this is
what caused the problem. If the example is run for a user whose user
name does not contain a space, then it works.

If you look at my comment from 2 days ago, you can see that the
classpath has percent encoding of spaces, which is wrong:

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m
-XX:CompileThreshold=100 -cp
/C:/Users/Andrew%20Bate/Downloads/scala-meter-issue
-93/target/scala-2.11/test-classes/;/C:/Users/Andrew%20Bate/Downloads/scala-meter-issue-93/target/scala-2.11/classes;/C:/Users/Andrew%20Bate/.ivy2/cac
he/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar;/C:/Users/Andrew%20Bate/.ivy2/cache/com.storm-enroute/scalameter_2.11/jars/scalameter_2.
11-0.6.jar;  
.......

Therefore, one hack that fixes the problem is to replace %20 with a
space in the classpath string, and to enclose the entire classpath in
double quotes.

The full working example that implements this temporary workaround is
the following:

package org.scalameter

import org.scalameter.api._

object RangeBenchmark extends PerformanceTest {

 /* configuration */

 override def executor = SeparateJvmsExecutor(
   new Executor.Warmer.Default,
   Aggregator.min,
   new Measurer.Default)
 override def reporter = new LoggingReporter
 override def persistor = Persistor.None

 /* inputs */

 def sizes = Gen.range("size")(300000, 1500000, 300000)

 def ranges = for {
   size <- sizes
 } yield 0 until size

 /* tests */

 val ctx = org.scalameter.dyn.currentContext.value
 org.scalameter.dyn.currentContext.withValue(ctx +
(org.scalameter.Key.classpath ->
org.scalameter.utils.ClassPath.default.split(";").mkString("\"", ";",
"\"").replace("%20"," "))) {
println("MODIFIED!!! " +
org.scalameter.dyn.currentContext.value.goe(org.scalameter.Key.classpath,
""))
   performance of "Range" in {
     measure method "map" in {
       using(ranges) in {
         r =>
         r.map(_ + 1)
       }
     }
   }
 }

}

Hence the implementation as-is is not guaranteed to work on Windows
machines when some directory on the classpath contains a space.

The proper fix would likely require that that the URIs on the classpath
are URL decoded (i.e. they do not contain percent encoding of spaces,
and possibly other things in cases I haven't thought of), and that the
full classpath is passed using quotes.

For example

"\"" + java.net.URLDecoder.decode("C:/Users/Joe%20Bloggs/") + "\""

is likely to be more reliable than

"\"" + "C:/Users/Joe%20Bloggs/".replace("%20", " ") + "\""

since it covers other cases that might also arise.

Passing the classpath in quotes works in both Command Prompt and cygwin
on Windows.

The double quotes should not be added around the classpath if the
example is run on *nix.

Now that we know what needs to be fixed, would it be possible to fix
the code? Many thanks.


Reply to this email directly or view it on GitHub:
#93 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@axel22 axel22 closed this in 3900b9f Jun 26, 2015

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 26, 2015

Member

The commit above should fix the issue. Please try in some 15 minutes with the 0.7-SNAPSHOT to see if the issue persists.

Member

axel22 commented Jun 26, 2015

The commit above should fix the issue. Please try in some 15 minutes with the 0.7-SNAPSHOT to see if the issue persists.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 28, 2015

The above commit does not fix the issue.

Running the same example as before, the classpath no longer has percent encoding of spaces but the entire classpath is not surrounded by double quotes. The relevant extract of the error is the following:

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m -XX:CompileThreshold=100 -cp /C:/Users/Andrew Bate/Downloads/scala-meter-issue-9
3-again/target/scala-2.11/test-classes/;/C:/Users/Andrew Bate/Downloads/scala-meter-issue-93-again/target/scala-2.11/classes;/C:/Users/Andrew Bate/.iv
y2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar;
...
[error] Error running separate JVM: java.lang.ClassCastException: cannot assign instance of scala.collection.immutable.HashMap$SerializationProxy to f
ield org.scalameter.Context.properties of type scala.collection.immutable.Map in instance of org.scalameter.Context

Would it possible to fix this? Many thanks again.

andrewdbate commented Jun 28, 2015

The above commit does not fix the issue.

Running the same example as before, the classpath no longer has percent encoding of spaces but the entire classpath is not surrounded by double quotes. The relevant extract of the error is the following:

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m -XX:CompileThreshold=100 -cp /C:/Users/Andrew Bate/Downloads/scala-meter-issue-9
3-again/target/scala-2.11/test-classes/;/C:/Users/Andrew Bate/Downloads/scala-meter-issue-93-again/target/scala-2.11/classes;/C:/Users/Andrew Bate/.iv
y2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar;
...
[error] Error running separate JVM: java.lang.ClassCastException: cannot assign instance of scala.collection.immutable.HashMap$SerializationProxy to f
ield org.scalameter.Context.properties of type scala.collection.immutable.Map in instance of org.scalameter.Context

Would it possible to fix this? Many thanks again.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 28, 2015

Member

Yes, that was a hasty fix.
I will submit another patch.

On June 28, 2015 5:34:28 PM GMT+02:00, Andrew D Bate notifications@github.com wrote:

The above commit not fix the issue.

Running the same example as before, the classpath no longer has percent
encoding of spaces but the entire classpath is not surrounded by
quotes. The relevant extract of the error is the following:

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m
-XX:CompileThreshold=100 -cp /C:/Users/Andrew
Bate/Downloads/scala-meter-issue-9
3-again/target/scala-2.11/test-classes/;/C:/Users/Andrew
Bate/Downloads/scala-meter-issue-93-again/target/scala-2.11/classes;/C:/Users/Andrew
Bate/.iv
y2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar;
...
[error] Error running separate JVM: java.lang.ClassCastException:
cannot assign instance of
scala.collection.immutable.HashMap$SerializationProxy to f
ield org.scalameter.Context.properties of type
scala.collection.immutable.Map in instance of org.scalameter.Context

Would it possible to fix this? Many thanks again.


Reply to this email directly or view it on GitHub:
#93 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

Member

axel22 commented Jun 28, 2015

Yes, that was a hasty fix.
I will submit another patch.

On June 28, 2015 5:34:28 PM GMT+02:00, Andrew D Bate notifications@github.com wrote:

The above commit not fix the issue.

Running the same example as before, the classpath no longer has percent
encoding of spaces but the entire classpath is not surrounded by
quotes. The relevant extract of the error is the following:

[info] Starting new JVM: java -server -verbose:gc -Xmx2048m -Xms2048m
-XX:CompileThreshold=100 -cp /C:/Users/Andrew
Bate/Downloads/scala-meter-issue-9
3-again/target/scala-2.11/test-classes/;/C:/Users/Andrew
Bate/Downloads/scala-meter-issue-93-again/target/scala-2.11/classes;/C:/Users/Andrew
Bate/.iv
y2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar;
...
[error] Error running separate JVM: java.lang.ClassCastException:
cannot assign instance of
scala.collection.immutable.HashMap$SerializationProxy to f
ield org.scalameter.Context.properties of type
scala.collection.immutable.Map in instance of org.scalameter.Context

Would it possible to fix this? Many thanks again.


Reply to this email directly or view it on GitHub:
#93 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 28, 2015

Member

The classpath argument should now be emitted in quotes.

49c1916

Member

axel22 commented Jun 28, 2015

The classpath argument should now be emitted in quotes.

49c1916

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 28, 2015

Has the snapshot been published? It still doesn't seem to work for me.

andrewdbate commented Jun 28, 2015

Has the snapshot been published? It still doesn't seem to work for me.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 28, 2015

Member

Looks like the Travis build was silently skipping the publish step when tests fail, instead of failing the build.

https://travis-ci.org/scalameter/scalameter/jobs/68517487

That is fixed, and the failing test is temporarily disabled.

Member

axel22 commented Jun 28, 2015

Looks like the Travis build was silently skipping the publish step when tests fail, instead of failing the build.

https://travis-ci.org/scalameter/scalameter/jobs/68517487

That is fixed, and the failing test is temporarily disabled.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 29, 2015

I've tried it, and it does fix it on Windows (either cygwin or Command Prompt) in the case where the classpath contains a space.

However, the last commit (49c1916) breaks everything (irrespective of whether the classpath contains a space or not) on *nix. On *nix systems, the classpath should not be surrounded with double quotes. (I've tried it, and contrary to what some websites say, it just doesn't work.)

andrewdbate commented Jun 29, 2015

I've tried it, and it does fix it on Windows (either cygwin or Command Prompt) in the case where the classpath contains a space.

However, the last commit (49c1916) breaks everything (irrespective of whether the classpath contains a space or not) on *nix. On *nix systems, the classpath should not be surrounded with double quotes. (I've tried it, and contrary to what some websites say, it just doesn't work.)

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 29, 2015

Member

Good, now we know that the thing works on Windows.
I will send another patch today.

On June 29, 2015 2:49:19 AM GMT+02:00, Andrew D Bate notifications@github.com wrote:

I've tried it, and it does fix it on Windows (either cygwin or Command
Prompt) in the case where the classpath contains a space.

However, the last commit (49c1916) breaks everything (irrespective
of whether the classpath contains a space or not) on *nix. On *nix
systems, the classpath should not be surrounded with double quotes.
(I've tried it, and contrary to what some websites say, it just doesn't
work.)


Reply to this email directly or view it on GitHub:
#93 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

Member

axel22 commented Jun 29, 2015

Good, now we know that the thing works on Windows.
I will send another patch today.

On June 29, 2015 2:49:19 AM GMT+02:00, Andrew D Bate notifications@github.com wrote:

I've tried it, and it does fix it on Windows (either cygwin or Command
Prompt) in the case where the classpath contains a space.

However, the last commit (49c1916) breaks everything (irrespective
of whether the classpath contains a space or not) on *nix. On *nix
systems, the classpath should not be surrounded with double quotes.
(I've tried it, and contrary to what some websites say, it just doesn't
work.)


Reply to this email directly or view it on GitHub:
#93 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 29, 2015

Member

That's what I get for pushing commits on the train. Everything should be fixed now, and I re-enabled the previously disabled test.

Member

axel22 commented Jun 29, 2015

That's what I get for pushing commits on the train. Everything should be fixed now, and I re-enabled the previously disabled test.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 30, 2015

I've just tried the snapshot again, and it works on Linux again.

However, it still doesn't work on Windows. I've look though your commits, and it appears that platformSpecificExtract is not being called from anywhere. It looks as though platformSpecificExtract should have been called everywhere instead of extract but isn't? If so, perhaps extract should have been marked as private[this] in object ClassPath so that this couldn't happen.

andrewdbate commented Jun 30, 2015

I've just tried the snapshot again, and it works on Linux again.

However, it still doesn't work on Windows. I've look though your commits, and it appears that platformSpecificExtract is not being called from anywhere. It looks as though platformSpecificExtract should have been called everywhere instead of extract but isn't? If so, perhaps extract should have been marked as private[this] in object ClassPath so that this couldn't happen.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 30, 2015

Member

I should give myself a facepalm or two.

It should be fixed in these commits:
bab568d
96b5dcf

Would be useful to have multi-platform tests in place.

Member

axel22 commented Jun 30, 2015

I should give myself a facepalm or two.

It should be fixed in these commits:
bab568d
96b5dcf

Would be useful to have multi-platform tests in place.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 30, 2015

I've just tried with the latest snapshot (I believe -- it seems to have updated on oss.sonatype.org) on Windows and it still isn't working. I haven't investigated why yet. Have you tired it using a path with spaces from Windows?

andrewdbate commented Jun 30, 2015

I've just tried with the latest snapshot (I believe -- it seems to have updated on oss.sonatype.org) on Windows and it still isn't working. I haven't investigated why yet. Have you tired it using a path with spaces from Windows?

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 30, 2015

Member

I went to Windows, checked out a clean repo clone to a dir with spaces in its path. I can confirm that this is a fix for me on Windows:

8f087ef

Member

axel22 commented Jun 30, 2015

I went to Windows, checked out a clean repo clone to a dir with spaces in its path. I can confirm that this is a fix for me on Windows:

8f087ef

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 30, 2015

I'll try again once it appears on Sonatype. Multi-platform tests are probably a must. Travis CI doesn't seem to accept Windows builds at this time. Is there an alternative to Travis which does (that perhaps could be used alongside Travis)?

andrewdbate commented Jun 30, 2015

I'll try again once it appears on Sonatype. Multi-platform tests are probably a must. Travis CI doesn't seem to accept Windows builds at this time. Is there an alternative to Travis which does (that perhaps could be used alongside Travis)?

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 30, 2015

Member

Other than Jenkins with a vm, none that I'm aware off at the moment.

Member

axel22 commented Jun 30, 2015

Other than Jenkins with a vm, none that I'm aware off at the moment.

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jun 30, 2015

It works! Many thanks.

I noticed during my testing, however, that spaces in the path are not supported on Linux. Should that be added to the todo list?

andrewdbate commented Jun 30, 2015

It works! Many thanks.

I noticed during my testing, however, that spaces in the path are not supported on Linux. Should that be added to the todo list?

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 30, 2015

Member

We will probably introduce a ClassPath class, that contains the classpath information in a platform-independent manner, and retrieves the actual string on-demand (I'm looking around if something similar already exists). At that point, we will fix Linux as well.

Member

axel22 commented Jun 30, 2015

We will probably introduce a ClassPath class, that contains the classpath information in a platform-independent manner, and retrieves the actual string on-demand (I'm looking around if something similar already exists). At that point, we will fix Linux as well.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jun 30, 2015

Member

Whitespaces should work on Linux now too:

6c0b136

Member

axel22 commented Jun 30, 2015

Whitespaces should work on Linux now too:

6c0b136

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jul 2, 2015

Just tried this on Linux and it works for me!

andrewdbate commented Jul 2, 2015

Just tried this on Linux and it works for me!

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jul 2, 2015

Member

Awesome, great to hear that!

Member

axel22 commented Jul 2, 2015

Awesome, great to hear that!

@andrewdbate

This comment has been minimized.

Show comment
Hide comment
@andrewdbate

andrewdbate Jul 22, 2015

Follow up on our exchange about continuous integration on Windows: Have you tired AppVeyor? It is apparently free for open source projects. The SBT native packager project uses it for its Windows tests (see https://github.com/sbt/sbt-native-packager). I haven't tried it, but it looks worth investigating.

andrewdbate commented Jul 22, 2015

Follow up on our exchange about continuous integration on Windows: Have you tired AppVeyor? It is apparently free for open source projects. The SBT native packager project uses it for its Windows tests (see https://github.com/sbt/sbt-native-packager). I haven't tried it, but it looks worth investigating.

@axel22

This comment has been minimized.

Show comment
Hide comment
@axel22

axel22 Jul 25, 2015

Member

No, I was not aware of it -- awesome, thanks for pointing out!
I've set up an AppVeyor build.

Member

axel22 commented Jul 25, 2015

No, I was not aware of it -- awesome, thanks for pointing out!
I've set up an AppVeyor build.

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