harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Wilson (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6312) Concurrency problems in NIO
Date Wed, 19 Aug 2009 21:49:14 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745221#action_12745221

Jesse Wilson commented on HARMONY-6312:

The patch includes a test fails on the original code, but passes on the RI and on the fixed

The patch makes some major surgery to SelectionKeyImpl. The fundamental change is that instead
of adjusting readableFDs and writableFDs as the keys and interest ops change, this adjusts
them before each select() operation. Select is already an O(N) operation (in terms of the
number of keys), so constructing this array will not hurt performance. It also guarantees
that the two arrays are "resized" the minimum number of times possible. The old code may grow
the arrays more than necessary, only to shrink them before the native call.

That file also received a small bit of documentation and style cleanup. Once this patch is
live, I volunteer to submit a follow up that will improve variable names.

> Concurrency problems in NIO
> ---------------------------
>                 Key: HARMONY-6312
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6312
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: SVN Revision: 801399
>            Reporter: Jesse Wilson
>         Attachments: NIO_Concurrency_issues.patch
>   Original Estimate: 72h
>  Remaining Estimate: 72h
> There's several potential concurrency problems in our NIO implementation...
>  - Charset#isSupported isn't synchronized, but it accesses mutable member cachedCharsetTable.
>  - In SelectionKeyImpl, stHash++ is a non-atomic operation so multiple SelectionKey instances
may receive the same hash code. (Why not use the default hash code?)
>  - In SelectorImpl, the unmodifiableKeys member is never synchronized on. But the documentation
specifies that clients can synchronize on that set to guard against changes
> These are the obvious problems; I suspect there are more subtle concurrency defects at
play here. I'll prepare a patch to address the major issues, and we should consider a rigorous
approach (Findbugs?) to discover concurrency problems.
> #Android

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message