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

8306040: HttpResponseInputStream.available() returns 1 on empty stream #14810

Closed
wants to merge 3 commits into from

Conversation

vyommani
Copy link
Contributor

@vyommani vyommani commented Jul 8, 2023

Please review the code change for JDK-8306040. In the overridden "available" method of "HttpResponseInputStream" we are returning 1 after exploring all the code path.


Progress

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

Issue

  • JDK-8306040: HttpResponseInputStream.available() returns 1 on empty stream (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14810/head:pull/14810
$ git checkout pull/14810

Update a local copy of the PR:
$ git checkout pull/14810
$ git pull https://git.openjdk.org/jdk.git pull/14810/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14810

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14810.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 8, 2023

👋 Welcome back vtewari! 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 Jul 8, 2023

@vyommani The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Jul 8, 2023
Comment on lines 540 to +541
if (iterator != null && iterator.hasNext()) return 1;
if (buffers.isEmpty()) return 0;
return 1;
if (!buffers.isEmpty() && buffers.peek() != LAST_LIST ) return 1;
Copy link
Member

Choose a reason for hiding this comment

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

Should probably be:

if (iterator != null && iterator.hasNext() && Utils.hasRemaining(buffers)) return 1;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean

if (iterator != null && iterator.hasNext() && Utils.hasRemaining(buffers.peek())) return 1; ?

Copy link
Member

Choose a reason for hiding this comment

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

Doh! Sorry ignore my suggestion. What you originally had seems reasonable. Give me some time to test.

@vyommani vyommani changed the title JDK-8306040:HttpResponseInputStream.available() returns 1 on empty stream 8306040: HttpResponseInputStream.available() returns 1 on empty stream Jul 10, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 10, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 10, 2023

Webrevs

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 8, 2023

@vyommani This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@vyommani
Copy link
Contributor Author

@dfuch can you please review this PR ?.

@dfuch
Copy link
Member

dfuch commented Aug 17, 2023

Hi Vyom, sorry I had forgotten about this. In principle the fix looks good but the new test has some stability issue. It fails intermittently (and frequently) when run in the CI:

java.lang.AssertionError: expected [1] but found [0]
at org.testng.Assert.fail(Assert.java:99)
at org.testng.Assert.failNotEquals(Assert.java:1037)
at org.testng.Assert.assertEqualsImpl(Assert.java:140)
at org.testng.Assert.assertEquals(Assert.java:122)
at org.testng.Assert.assertEquals(Assert.java:907)
at org.testng.Assert.assertEquals(Assert.java:917)
at HttpInputStreamAvailableTest.test(HttpInputStreamAvailableTest.java:103)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:102)
at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:58)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1570)

@vyommani vyommani requested a review from dfuch August 21, 2023 04:36
@openjdk
Copy link

openjdk bot commented Aug 21, 2023

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

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

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

8306040: HttpResponseInputStream.available() returns 1 on empty stream

Reviewed-by: dfuchs

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 490 new commits pushed to the master branch:

  • 096b7ff: 8314810: (fs) java/nio/file/Files/CopyInterference.java should use TestUtil::supportsLinks
  • 6261020: 8312555: Ideographic characters aren't stretched by AffineTransform.scale(2, 1)
  • 703817d: 8314517: some tests fail in case ipv6 is disabled on the machine
  • 742e319: 8314157: G1: "yielded" is not initialized on some paths after JDK-8140326
  • 1cee3b9: 8313262: C2: Sinking node may cause required cast to be dropped
  • f8203cb: 8313626: C2 crash due to unexpected exception control flow
  • 2be469f: 8314743: Use of uninitialized local in SR_initialize after JDK-8314114
  • 571c435: 8313374: --enable-ccache's CCACHE_BASEDIR breaks builds
  • d1de3d0: 8313901: [TESTBUG] test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java fails with java.lang.VirtualMachineError
  • a0d0f21: 8314752: Use google test string comparison macros
  • ... and 480 more: https://git.openjdk.org/jdk/compare/292ee630ae32c3b50363b10ffa6090e57ffef1e8...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 added the ready Pull request is ready to be integrated label Aug 21, 2023
@vyommani
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 24, 2023

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

  • 76b9011: 8314656: GHA: No need for Debian ports keyring installation after JDK-8313701
  • e36620d: 8314554: Debian/Ubuntu should not link OpenJDK with --as-needed link option
  • 97b94cb: 8314883: Java_java_util_prefs_FileSystemPreferences_lockFile0 write result errno in missing case
  • 75e19e0: 8314819: [JVMCI] HotSpotJVMCIRuntime.lookupType throws unexpected ClassNotFoundException
  • c418933: 8313530: VM build without C2 fails after JDK-8312579
  • de0e46c: 8303815: Improve Metaspace test speed
  • 3699666: 8313319: [linux] mmap should use MAP_FIXED_NOREPLACE if available
  • 3285a1e: 8314555: Build with mawk fails on Windows
  • 4a50e87: 8303852: current_stack_region() gets called twice unnecessarily
  • c077be4: 8314694: Separate checked_cast from globalDefinitions.hpp
  • ... and 497 more: https://git.openjdk.org/jdk/compare/292ee630ae32c3b50363b10ffa6090e57ffef1e8...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 24, 2023

@vyommani Pushed as commit acaab6f.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
2 participants