You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Josh Guilfoyle (JIRA)" <ji...@apache.org> on 2009/11/26 06:27:39 UTC
[jira] Created: (HARMONY-6390) Socket state methods are not
properly synchronized
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.