|
[#1109] |
project: compiler |
priority: high |
category: bug |
|
submitter |
assigned to |
status |
date submitted |
|
Nikolay |
Sean |
fixed |
2007-05-15 13:02:58.0 |
subject |
[contrib #470] WeakReference.toString throws NoSuchElementException (race condition) |
code |
import scala.ref._
import scala.concurrent._
def test =
while (true) {
val r = new WeakReference(List(1, 2))
r.toString
}
ops.spawn(test)
ops.spawn(test)
ops.spawn(test)
|
what happened |
Exception in thread "Thread-1" java.util.NoSuchElementException
at scala.ref.ReferenceWrapper$class.apply(ReferenceWrapper.scala:21)
at scala.ref.WeakReference.apply(WeakReference.scala:16)
at scala.ref.Reference$class.toString(Reference.scala:20)
at scala.ref.WeakReference.toString(WeakReference.scala:16)
at $scala5cr1p7-haX0R.Main$.test$0((virtual file):11)
at $scala5cr1p7-haX0R.Main$$anonfun$1.apply((virtual file):15)
at $scala5cr1p7-haX0R.Main$$anonfun$1.apply((virtual file):15)
at scala.concurrent.ops$$anon$0.run(ops.scala:28)
Exception in thread "Thread-0" java.util.NoSuchElementException
at scala.ref.ReferenceWrapper$class.apply(ReferenceWrapper.scala:21)
at scala.ref.WeakReference.apply(WeakReference.scala:16)
at scala.ref.Reference$class.toString(Reference.scala:20)
at scala.ref.WeakReference.toString(WeakReference.scala:16)
at $scala5cr1p7-haX0R.Main$.test$0((virtual file):11)
at $scala5cr1p7-haX0R.Main$$anonfun$0.apply((virtual file):14)
at $scala5cr1p7-haX0R.Main$$anonfun$0.apply((virtual file):14)
at scala.concurrent.ops$$anon$0.run(ops.scala:28)
|
what expected |
nothing printed, because weakReference.toString should not throw, and should return referenced object .toString or <deleted> |
[back to overview] |