-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
8309305: sun/security/ssl/SSLSocketImpl/BlockedAsyncClose.java fails with jtreg test timeout #14378
Conversation
…with jtreg test timeout
👋 Welcome back mdonovan! A progress list of the required criteria for merging this PR into |
Webrevs
|
Co-authored-by: Andrey Turbanov <turbanoff@gmail.com>
@mpdonova 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! |
Can someone please review this? Thanks! |
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.
LGTM.
Some OSes spontaneously increase the buffer size after a few seconds, unblocking blocked write operations. We also use 10 seconds limit in networking tests, seems to work pretty well. See
jdk/test/jdk/java/net/httpclient/websocket/PendingOperations.java
Lines 43 to 47 in 9e4fc56
// Time after which we deem that the local send buffer and remote | |
// receive buffer must be full. | |
// At the time of writing, using anything <= 5s on Mac will make the | |
// tests fail intermittently. | |
static final long MAX_WAIT_SEC = 10; // seconds. |
@mpdonova 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:
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 538 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. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 8042a50.
Your commit was automatically rebased without conflicts. |
This PR improves the reliability of the BlockedAsyncClose test by addressing an edge case/race condition between the two test threads. The purpose of the test is to verify that an SSLSocket can be closed if a thread is blocked in a write operation.
The test starts a "write" thread that writes data to a socket until the output buffer was filled, causing the write operation to block. The main thread then calls
SSLSocket.close()
. The original code usedThread.sleep(1000)
to wait for the write-thread to block. However, 1 second isn't always long enough and if the write-thread isn't blocked and the output buffer is full (or almost full), thesocket.close()
call may block when it tries to send the close_notify alert. This is the condition that caused this bug.My change uses a Lock to determine if the write thread is blocked. In the write thread, the lock creates a critical section around the
write()
call. The main thread usestryLock()
with a timeout to determine that the write() call is taking too long and thus likely blocked.While there, I also updated the test to use the SSLContextTemplate class.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14378/head:pull/14378
$ git checkout pull/14378
Update a local copy of the PR:
$ git checkout pull/14378
$ git pull https://git.openjdk.org/jdk.git pull/14378/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14378
View PR using the GUI difftool:
$ git pr show -t 14378
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14378.diff
Webrev
Link to Webrev Comment