You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2014/11/04 12:11:33 UTC
[jira] [Created] (DIRMINA-994) The ConnectionRequest.cancel()
method is inconsistent wrt concurrent access
Emmanuel Lecharny created DIRMINA-994:
-----------------------------------------
Summary: The ConnectionRequest.cancel() method is inconsistent wrt concurrent access
Key: DIRMINA-994
URL: https://issues.apache.org/jira/browse/DIRMINA-994
Project: MINA
Issue Type: Bug
Affects Versions: 2.0.9
Reporter: Emmanuel Lecharny
Priority: Critical
Fix For: 2.0.10
When we call the ConnectionRequest.cancel() method, it does :
{code}
public void cancel() {
if (!isDone()) {
super.cancel();
cancelQueue.add(this);
startupWorker();
wakeup();
}
{code}
The problem is that the isDone() method is :
{code}
public boolean isDone() {
synchronized (lock) {
return ready;
}
}
{code}
and the super.cancel() method is :
{code}
public void cancel() {
setValue(CANCELED);
}
{code}
with the setValue() method :
{code}
public void setValue(Object newValue) {
synchronized (lock) {
// Allowed only once.
if (ready) {
return;
}
result = newValue;
ready = true;
...
{code}
At this point, we may have the 'ready' flag set to false, enter into the super.cancel() method, and have the 'ready' flag set to true when we check it again, but still we will add the current connectRequest into the cancel queue, when we should not.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)