Hello all; (Chris is on holiday so I agreed to finish the review on this change)
I have updated the changeset with the regression test Doug provided. I have also verified that the regression test fails without the provided patch. http://cr.openjdk.java.net/~mduigou/JDK-8004138/0/webrev/ Mike On Oct 14 2013, at 08:52 , Chris Hegarty <chris.hega...@oracle.com> wrote: > This is a request to pull a small change to ForkJoinTask into jdk8, from the > jsr166 CVS. This was first discussed over on c-i [1] a few weeks back. > > diff -r 077237e4613f src/share/classes/java/util/concurrent/ForkJoinTask.java > --- a/src/share/classes/java/util/concurrent/ForkJoinTask.java Mon Oct 14 > 11:47:54 2013 +0100 > +++ b/src/share/classes/java/util/concurrent/ForkJoinTask.java Mon Oct 14 > 16:44:01 2013 +0100 > @@ -439,11 +439,13 @@ public abstract class ForkJoinTask<V> im > final Throwable ex; > ExceptionNode next; > final long thrower; // use id not ref to avoid weak cycles > + final int hashCode; // store task hashCode before weak ref > disappears > ExceptionNode(ForkJoinTask<?> task, Throwable ex, ExceptionNode next) > { > super(task, exceptionTableRefQueue); > this.ex = ex; > this.next = next; > this.thrower = Thread.currentThread().getId(); > + this.hashCode = System.identityHashCode(task); > } > } > > @@ -605,9 +607,9 @@ public abstract class ForkJoinTask<V> im > private static void expungeStaleExceptions() { > for (Object x; (x = exceptionTableRefQueue.poll()) != null;) { > if (x instanceof ExceptionNode) { > - ForkJoinTask<?> key = ((ExceptionNode)x).get(); > + int hashCode = ((ExceptionNode)x).hashCode; > ExceptionNode[] t = exceptionTable; > - int i = System.identityHashCode(key) & (t.length - 1); > + int i = hashCode & (t.length - 1); > ExceptionNode e = t[i]; > ExceptionNode pred = null; > while (e != null) { > > > -Chris > > [1] > http://jsr166-concurrency.10961.n7.nabble.com/ForkJoinTask-leaks-exceptions-td10134.html