RFR: 8334719: (se) Deferred close of SelectableChannel may result in a Selector doing the final close before concurrent I/O on channel has completed [v4]

Jaikiran Pai jpai at openjdk.org
Wed Jun 26 07:52:24 UTC 2024


> Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8334719?
> 
> Alan's comment in that issue summarizes what this issue is about https://bugs.openjdk.org/browse/JDK-8334719?focusedId=14684071&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14684071. As noted there, the deferred close implementation in several of the `SelectableChannel` implementations have a bug where they don't check for in-progress operations on the channel when closing/releasing the underlying resources of the channel. We started noticing this with `DatagramChannel` consistenly, but the issue is applicable for other channel implementations as well. 
> 
> The fix for the issue in this PR has been provided by Alan and I've run the necessary tests several thousand times to verify that it fixes the original issue. 
> 
> A new jtreg test has been introduced to reproduce the bug and verify the fix. Without the fix, the new test consistently fails for all test method (except for ServerSocketChannel, where it isn't easy to trigger a race). With the fix all tests consistently pass.
> 
> A successful test run of the new test takes around 60 seconds. So I've intentionally set a timeout of 4 minutes on the test to allow for some leeway on slow CI systems.
> 
> Another round of tier testing with these changes is currently in progress.

Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision:

 - higher timeout isn't necessary for reduced iterations
 - reduce number of iterations in the test

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/19879/files
  - new: https://git.openjdk.org/jdk/pull/19879/files/acbcbfe4..48956807

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19879&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19879&range=02-03

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/19879.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19879/head:pull/19879

PR: https://git.openjdk.org/jdk/pull/19879


More information about the nio-dev mailing list