[
https://issues.apache.org/jira/browse/DIRMINA-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12868236#action_12868236
]
Bill Kuker edited comment on DIRMINA-382 at 5/17/10 12:10 PM:
--------------------------------------------------------------
I am pretty sure there is a race here that can result in the connection being
closed [before all data is written]. I first believed the problem was in SSHD:
https://issues.apache.org/jira/browse/SSHD-85
The code below looks like the culprit:
@Override public WriteRequest peek() {
WriteRequest answer = super.peek();
if (answer == CLOSE_REQUEST) {
AbstractIoSession.this.close();
clear();
answer = null;
}
return answer;
}
The close() sometimes gets processed before the previously returned
WriteRequest is actually written. The consumer of this queue seems to put the
writes into another queue, or somehow deal with them asynchronously.
was (Author: bkuker1):
I am pretty sure there is a race here that can result in the connection
being closed. I first believed the problem was in SSHD:
https://issues.apache.org/jira/browse/SSHD-85
The code below looks like the culprit:
@Override public WriteRequest peek() {
WriteRequest answer = super.peek();
if (answer == CLOSE_REQUEST) {
AbstractIoSession.this.close();
clear();
answer = null;
}
return answer;
}
The close() sometimes gets processed before the previously returned
WriteRequest is actually written. The consumer of this queue seems to put the
writes into another queue, or somehow deal with them asynchronously.
> Provide a close() method that doesn't close the connection until all messages
> are written.
> ------------------------------------------------------------------------------------------
>
> Key: DIRMINA-382
> URL: https://issues.apache.org/jira/browse/DIRMINA-382
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: Trustin Lee
> Assignee: Trustin Lee
> Fix For: 2.0.0-M1
>
>
> Currently, IoSession.close() closes the connection immediately no matter how
> many messages are not written yet. Calling close() will discard all pending
> writes and close the connection immediately. Although we can add a
> IoFutureListener.CLOSE to the last WriteFuture, it will be more convenient to
> provide another close method that doesn't close the connection until all
> message are written.
> Adding a boolean parameter to the close method will be fine. Of course,
> original method without a parameter will be retained.
> To implement this, the implementation should satisfy the following condition.
> 1) IoSession.isClosing() must return true after close() is called no matter
> what boolean parameter is specified.
> 2) The session should be closed after all messages are written out.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.