harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Guilfoyle (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6390) Socket state methods are not properly synchronized
Date Thu, 26 Nov 2009 05:27:39 GMT
Socket state methods are not properly synchronized
--------------------------------------------------

                 Key: HARMONY-6390
                 URL: https://issues.apache.org/jira/browse/HARMONY-6390
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M11
         Environment: Affects all platforms
            Reporter: Josh Guilfoyle
            Priority: Minor


The java.net.Socket implementation has a handful of non-volatile boolean state values including
isConnected, isClosed, isBound, etc which are all guarded by the Socket's monitor lock (this)
on write, but are not properly synchronized on read.

The following snippet from the source tree demonstrates the issue:

private boolean isClosed = false;

public synchronized void close() throws IOException {
    isClosed = true;
    impl.close();
}

public boolean isClosed() {
    return isClosed;
}

This means that a thread calling isClosed() may see a stale value after another thread called
close().


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


Mime
View raw message