Skip to content
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

8269258: java/net/httpclient/ManyRequestsLegacy.java failed with connection timeout #2696

Closed
wants to merge 3 commits into from

Conversation

amosshi
Copy link
Contributor

@amosshi amosshi commented Apr 30, 2024

Backport of JDK-8269258, a pre-required dependency to JDK-8327989

  • This PR contains 3 commits
  • Commit 1 - is the git apply from the original commit
  • Commit 2 - is the manual merge based on the .rej files. This commit can be considered as clean
    • ManyRequests.java.rej
    • ManyRequestsLegacy.java.rej
  • Commit 3 - converts the record type to class
    • Record type was added in Java 14 via JEP 359

Contents

  • ManyRequests.java.rej content
@@ -54,13 +55,18 @@
 import java.net.http.HttpClient.Builder;
 import java.net.http.HttpRequest;
 import java.net.http.HttpRequest.BodyPublishers;
+import java.net.http.HttpResponse;
 import java.net.http.HttpResponse.BodyHandlers;
 import java.time.Duration;
 import java.util.Arrays;
 import java.util.Formatter;
 import java.util.HashMap;
 import java.util.LinkedList;
+import java.util.Map;
 import java.util.Random;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
@@ -100,14 +116,14 @@
     }
 
     //static final int REQUESTS = 1000;
-    static final int REQUESTS = 20;
+    static final int REQUESTS = MAX_COUNT;
     static final boolean INSERT_DELAY = Boolean.getBoolean("test.insertDelay");
     static final int CHUNK_SIZE = Math.max(0,
            Integer.parseInt(System.getProperty("test.chunkSize", "0")));
     static final boolean XFIXED = Boolean.getBoolean("test.XFixed");
 
     static class TestEchoHandler extends EchoHandler {
-        final Random rand = jdk.test.lib.RandomFactory.getRandom();
+        final Random rand = RANDOM;
         @Override
         public void handle(HttpExchange e) throws IOException {
             System.out.println("Server: received " + e.getRequestURI());
  • ManyRequestsLegacy.java.rej content
@@ -73,12 +80,20 @@
 import java.util.Random;
 import java.util.logging.Logger;
 import java.util.logging.Level;
+
+import jdk.test.lib.Platform;
+import jdk.test.lib.RandomFactory;
 import jdk.test.lib.net.SimpleSSLContext;
 import static java.net.Proxy.NO_PROXY;
 
 public class ManyRequestsLegacy {
 
-    volatile static int counter = 0;
+    static final int MAX_COUNT = 20;
+    static final int MAX_LIMIT = 40;
+    static final AtomicInteger COUNT = new AtomicInteger();
+    static final AtomicInteger LIMIT = new AtomicInteger(MAX_LIMIT);
+    static final Random RANDOM = RandomFactory.getRandom();
+
 
     public static void main(String[] args) throws Exception {
         Logger logger = Logger.getLogger("com.sun.net.httpserver");

Testing

  • Local: Test passed on MacOS 14.4.1
    • ManyRequests.java: Test results: passed: 1
    • ManyRequests2.java: Test results: passed: 1
    • ManyRequestsLegacy.java: Test results: passed: 1
  • Pipeline: All checks have passed
  • Testing Machine: SAP nightlies SKIPPED on 2024-05-02
    • Automated jtreg test: jtreg_jdk_tier2
    • java/net/httpclient/ManyRequests.java: SUCCESSFUL GitHub 📊⏲ - [62,025 msec]
    • java/net/httpclient/ManyRequests2.java: SUCCESSFUL GitHub 📊⏲ - [67,176 msec]
    • java/net/httpclient/ManyRequestsLegacy.java: SUCCESSFUL GitHub 📊⏲ - [48,737 msec]

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • JDK-8269258 needs maintainer approval
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8269258: java/net/httpclient/ManyRequestsLegacy.java failed with connection timeout (Bug - P4 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/2696/head:pull/2696
$ git checkout pull/2696

Update a local copy of the PR:
$ git checkout pull/2696
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/2696/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2696

View PR using the GUI difftool:
$ git pr show -t 2696

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/2696.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 30, 2024

👋 Welcome back ashi! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 30, 2024

@amosshi This change now passes all automated pre-integration checks.

After integration, the commit message for the final commit will be:

8269258: java/net/httpclient/ManyRequestsLegacy.java failed with connection timeout

Reviewed-by: rrich

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 17 new commits pushed to the master branch:

  • c542dc9: 8325579: Inconsistent behavior in com.sun.jndi.ldap.Connection::createSocket
  • 4202063: 8293563: [macos-aarch64] SA core file tests failing with sun.jvm.hotspot.oops.UnknownOopException
  • b7822c3: 8331643: [11u]: Bump GHA bootstrap JDK to 11.0.23
  • 3f636f3: 8310818: Refactor more Locale tests to use JUnit
  • 1da8fd8: 8295343: sun/security/pkcs11 tests fail on Linux RHEL 8.6 and newer
  • cabaf74: 8305931: jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java failed with "Expected chains but found none"
  • 137a8b9: 8308021: Update IANA Language Subtag Registry to Version 2023-05-11
  • d42634b: 8263940: NPE when creating default file system when default file system provider is packaged as JAR file on class path
  • 9363095: 8328194: Add a test to check default rendering engine
  • 81f2413: 8318809: java/util/concurrent/ConcurrentLinkedQueue/WhiteBox.java shows intermittent failures on linux ppc64le and aarch64
  • ... and 7 more: https://git.openjdk.org/jdk11u-dev/compare/f3d0f2bac0a01c992760826bc006f4f4c55584ed...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title Backport 37921e30803449c06b4d542fdfeed9928cce8a7d 8269258: java/net/httpclient/ManyRequestsLegacy.java failed with connection timeout Apr 30, 2024
@openjdk
Copy link

openjdk bot commented Apr 30, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport rfr Pull request is ready for review labels Apr 30, 2024
@mlbridge
Copy link

mlbridge bot commented Apr 30, 2024

Webrevs

Copy link
Member

@reinrich reinrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
Cheers, Richard.

@openjdk
Copy link

openjdk bot commented May 7, 2024

⚠️ @amosshi This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@amosshi
Copy link
Contributor Author

amosshi commented May 7, 2024

/approval request "Un-Clean backport. No risk, test fix. SAP nightlies passed on 2024-05-02”

@openjdk
Copy link

openjdk bot commented May 7, 2024

@amosshi
8269258: The approval request has been created successfully.

@openjdk openjdk bot added approval ready Pull request is ready to be integrated and removed approval labels May 7, 2024
@amosshi
Copy link
Contributor Author

amosshi commented May 8, 2024

/integrate

@openjdk
Copy link

openjdk bot commented May 8, 2024

Going to push as commit 665e1cd.
Since your change was applied there have been 20 commits pushed to the master branch:

  • 4c81a1c: 8283349: Robustness improvements to java/util/prefs/AddNodeChangeListener.jar
  • 6b225d5: 8253980: javax/swing/plaf/synth/7158712/bug7158712.java fails on windows
  • b9cb572: 8313702: Update IANA Language Subtag Registry to Version 2023-08-02
  • c542dc9: 8325579: Inconsistent behavior in com.sun.jndi.ldap.Connection::createSocket
  • 4202063: 8293563: [macos-aarch64] SA core file tests failing with sun.jvm.hotspot.oops.UnknownOopException
  • b7822c3: 8331643: [11u]: Bump GHA bootstrap JDK to 11.0.23
  • 3f636f3: 8310818: Refactor more Locale tests to use JUnit
  • 1da8fd8: 8295343: sun/security/pkcs11 tests fail on Linux RHEL 8.6 and newer
  • cabaf74: 8305931: jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java failed with "Expected chains but found none"
  • 137a8b9: 8308021: Update IANA Language Subtag Registry to Version 2023-05-11
  • ... and 10 more: https://git.openjdk.org/jdk11u-dev/compare/f3d0f2bac0a01c992760826bc006f4f4c55584ed...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 8, 2024
@openjdk openjdk bot closed this May 8, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 8, 2024
@openjdk
Copy link

openjdk bot commented May 8, 2024

@amosshi Pushed as commit 665e1cd.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@amosshi amosshi deleted the backport-8269258 branch June 11, 2024 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants