Bug 1213280

Summary: ForkJoinPool missing submission of Runnable
Product: Red Hat Enterprise Linux 7 Reporter: Stanislav Baiduzhyi <sbaiduzh>
Component: java-1.8.0-openjdkAssignee: Andrew John Hughes <ahughes>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.1CC: ahughes, chphilli, dbhole, isenfeld, oskutka, sbaiduzh
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 03:51:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stanislav Baiduzhyi 2015-04-20 08:54:23 UTC
Refactoring of ForkJoin, introduced in 8u40, breaks the runnable submission to the thread pool.

Following code finishes immediately on 8u31 and earlier, but never stops on 8u40 and 8u45.

Reproducer code:

import java.util.concurrent.*;
import java.util.concurrent.atomic.*;

public class ForkJoinPoolThrottling {
    public static void main(String[] args) throws Throwable {
        final ForkJoinPool e = new ForkJoinPool(1);
        final AtomicBoolean b = new AtomicBoolean();
        final Runnable setFalse = new Runnable() { public void run() {
            b.set(false);
        }};
        for (int i = 0; i < 100000; i++) {
            b.set(true);
            e.execute(setFalse);
            do {} while (b.get()); // spins forever here
        }
    }
}

Comment 2 Andrew John Hughes 2015-04-20 16:04:58 UTC
Is this:

changeset:   10054:2188a4078a0a
user:        dl
date:        Fri Sep 05 10:54:28 2014 +0200
summary:     8056248: Improve ForkJoin thread throttling

It sounds like something that needs to be raised upstream.

Comment 3 Chris Phillips @ TO 2015-05-25 10:58:51 UTC
http://hg.openjdk.java.net/jdk9/dev/jdk/rev/97a1facbcaaa
I think (at least for jdk8).

Chris

Comment 4 Andrew John Hughes 2015-05-26 02:12:42 UTC
In 8u: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/b51c6914f297

Comment 5 Andrew John Hughes 2015-06-12 16:00:26 UTC
"This resolution should not be used for Red Hat Enterprise Linux bugs."

https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_status

Comment 6 Andrew John Hughes 2015-07-07 13:10:35 UTC
Without patch:

$ /usr/lib/jvm/java-1.8.0-openjdk/bin/java -version
openjdk version "1.8.0_45"
OpenJDK Runtime Environment (build 1.8.0_45-b13)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)

$ /usr/lib/jvm/java-1.8.0-openjdk/bin/java RH1213280
(stalls)

With patch:

$ /usr/lib/jvm/java-1.8.0-openjdk/bin/java -version
openjdk version "1.8.0_51"
OpenJDK Runtime Environment (build 1.8.0_51-b16)
OpenJDK 64-Bit Server VM (build 25.51-b03, mixed mode)

$ /usr/lib/jvm/java-1.8.0-openjdk/bin/java RH1213280
$ 
(completes)

Comment 11 errata-xmlrpc 2015-11-19 03:51:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2181.html