You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Lyor Goldstein (Jira)" <ji...@apache.org> on 2022/04/10 15:49:00 UTC
[jira] [Commented] (SSHD-1261) Sometimes async write listener is not called
[ https://issues.apache.org/jira/browse/SSHD-1261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17520193#comment-17520193 ]
Lyor Goldstein commented on SSHD-1261:
--------------------------------------
Makes sense - will fix this some time soon. Not sure about {{IoWriteFutureImpl future = pendingWrite.get()}} perhaps better {{IoWriteFutureImpl future = pendingWrite.getAndSet(null)}}
> Sometimes async write listener is not called
> --------------------------------------------
>
> Key: SSHD-1261
> URL: https://issues.apache.org/jira/browse/SSHD-1261
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 2.8.0
> Reporter: Evgeny Pasynkov
> Priority: Major
>
> Hello,
> I have discovered the case when the async write listener is not called.
> Imagine the case: The `ChannelAsyncOutputStream::doWriteIfPossible` method discover that window size is too small (lines 160-167). It setup new future and exit the doWriteIfPossible method, relying on `onWindowExpanded` will be called shortly. But if the channel is disconnected, the method will never be invoked, thus future won't be completed.
> I suggest adding the following override to ChannelAsyncOutputStream class:
> {code:java}
> @Override
> protected void doCloseImmediately() {
> abortCurrentWrite();
> super.doCloseImmediately();
> }
> protected synchronized void abortCurrentWrite() {
> IoWriteFutureImpl future = pendingWrite.get();
> if (future != null) {
> future.setValue(new ClosedChannelException());
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org