[ https://issues.apache.org/jira/browse/SSHD-1257?focusedWorklogId=751409&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-751409 ]
ASF GitHub Bot logged work on SSHD-1257: ---------------------------------------- Author: ASF GitHub Bot Created on: 01/Apr/22 06:22 Start Date: 01/Apr/22 06:22 Worklog Time Spent: 10m Work Description: lgoldstein commented on a change in pull request #214: URL: https://github.com/apache/mina-sshd/pull/214#discussion_r840270775 ########## File path: sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java ########## @@ -908,7 +908,7 @@ protected void closeShell(int exitValue, boolean closeImmediately) throws IOExce if (!isClosing()) { if (out != null) { - out.flush(); Review comment: > out.close() works because this is indeed the last use of this stream. Looks fine to me... I trust your judgment @tomaswolf > The intent is obviously to get all data from the command sent before the EOF is sent. But why not also flush or close err? What happens if the command writes something to the error stream? err gets closed only in the close() call in line 916, so that would flush it after the EOF (and the exit status) was sent. That's probably not OK. I tend to agree with you... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 751409) Time Spent: 1h 50m (was: 1h 40m) > Shell is not getting closed if the command has already closed the > OutputStream it is using. > ------------------------------------------------------------------------------------------- > > Key: SSHD-1257 > URL: https://issues.apache.org/jira/browse/SSHD-1257 > Project: MINA SSHD > Issue Type: Bug > Affects Versions: 2.9.0 > Reporter: Vincent Latombe > Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > When running a org.apache.sshd.server.command.Command, if it happens to close > the OutputStream instance it is using, then later when the ssh session > closes, it attempts to flush the output stream before closing it. > This causes theĀ following warning to be printed on server side > {code:java} > WARNING o.a.s.s.channel.ChannelSession#lambda$prepareCommand$0: > onExit(ChannelSession[id=0, > recipient=0]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:49944]) code=0 > message='' SshChannelClosedException closing shell: > flush(ChannelOutputStream[ChannelSession[id=0, > recipient=0]-ServerSessionImpl[admin@/0:0:0:0:0:0:0:1:49944]] > SSH_MSG_CHANNEL_DATA) length=0 - stream is already closed > {code} > and EOF is never sent to client. -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org