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
8274780: ChannelInputStream.readNBytes(int) incorrectly calls readAllBytes() #5824
Conversation
|
I had to increase the test timeout. Even the original test required about 8 minutes to run on my test machines, which has pretty good single-thread performance. |
@fweimer-rh The following label will be automatically applied to this pull request:
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. |
Webrevs
|
* @summary Verify ChannelInputStream methods readAllBytes and readNBytes | ||
* @library .. | ||
* @library /test/lib | ||
* @build jdk.test.lib.RandomFactory | ||
* @modules java.base/jdk.internal.util | ||
* @run testng/othervm -Xmx8G ReadXBytes | ||
* @run testng/othervm/timeout=3600 -Xmx8G ReadXBytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you running the tests with the make target or jtreg without -timeoutFactor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm invoking jtreg directly, following Running tests using jtreg. That page doesn't mention -timeoutFactor
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm invoking jtreg directly, following Running tests using jtreg. That page doesn't mention
-timeoutFactor
.
Okay, I think RunTests.gmk sets it to 4 but it can be overridden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I lower the timeout to 900 then? With a factor of 4, that should be enough to run the test even on fairly slow machines.
InputStream cis = Channels.newInputStream(ch)) { | ||
f.test(length, cis, fis); | ||
} finally { | ||
Files.delete(file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see this cleaned up a bit. The line break at L154 make it hard to read. Having 4 resources in the same try-with-resources is also hard to read. The comment "relationship is obscured" will confuse further maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How important is exception correctness in the test code? Is it acceptable to leak resources on VM errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How important is exception correctness in the test code? Is it acceptable to leak resources on VM errors?
The tests usually run in agentvm mode so if failing tests leak then it may have knock impact to tests that run later in the same VM. So if we can clean up then we should. Sometimes we have tests that can't reliably cleanup, they can run in othervm mode that is runs just the one test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant whether it's acceptable to use a construct like try (var ch = Channels.newInputStream(new FileInputStream(f)))
. The input stream could leak there, but only in case of VM errors.
InputStream cis = Channels.newInputStream(fc)) { | ||
f.test(length, cis, fis); | ||
try { | ||
for (boolean hideSeek : List.of(false, true)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a bit clearer if you renamed this to "seekable"
@fweimer-rh This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
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 31 new commits pushed to the
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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@AlanBateman, @bplb) but any other Committer may sponsor as well.
|
/integrate |
@fweimer-rh |
/sponsor |
Going to push as commit 5762ec2.
Your commit was automatically rebased without conflicts. |
@AlanBateman @fweimer-rh Pushed as commit 5762ec2. |
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5824/head:pull/5824
$ git checkout pull/5824
Update a local copy of the PR:
$ git checkout pull/5824
$ git pull https://git.openjdk.java.net/jdk pull/5824/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5824
View PR using the GUI difftool:
$ git pr show -t 5824
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5824.diff