[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16636291#comment-16636291 ] jpalacios commented on SSHD-340: Hi [~gnt] / [~lgoldstein], I was wondering if I could get some context into this change. For Bitbucket Server this was an API breaking change because whenever an admin changes the server port we would stop the server and start it on the new port number. It's not a big effort to create a new server but I'm worried about these types of changes in a minor release and I'm whether we should expect to find more changes like this in this release and/or future ones. Cheers Juan > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Fix For: 2.0.1 > > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16555852#comment-16555852 ] Jared Wiltshire commented on SSHD-340: -- [~gnt] Thanks for clearing that up. If its not intended to be restarted then perhaps a Javadoc comment would be helpful explaining this. Also it should definitely not allow itself to be restarted as it ends up in a state where it can't be stopped. > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=1658#comment-1658 ] Guillaume Nodet commented on SSHD-340: -- Hopefully both issues will help. > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16555414#comment-16555414 ] Goldstein Lyor commented on SSHD-340: - I defer to your judgment here - please revert the change I made and add the commit you think is best suited... > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16555338#comment-16555338 ] Goldstein Lyor commented on SSHD-340: - {quote} For example Nio2ServiceFactory does perform a group.awaitTermination during doCloseImmediately() which is wrong {quote} I am not so sure - there is a (cryptic remark) that says {code:java} // if we protect the executor then the await will fail since we didn't really shut it down... {code} in any case, the {{awaitTermination}} call is executed only if {{isShutdownOnExit}} > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16555357#comment-16555357 ] Guillaume Nodet commented on SSHD-340: -- I don't think this is a good idea to allow restarting a closed object. One reason is that all the gracefull stuff will not work either because in your commit, the {{CloseFuture}} of the {{AbstractCloseable}} is not reset. And it's not meant to be since the field is final. This also cascades to all inner objects of the client / server. I think it's wiser to just recreate the server. On the thread shutdown, I think we should integrate one commit I did a few weeks ago, mainly https://github.com/gnodet/mina-sshd/commit/58f7198c5a32184d6bff6bc08a4317cc4deb2a67, that may help a bit. > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16555194#comment-16555194 ] Goldstein Lyor commented on SSHD-340: - I added a reset of the state back to {{Opened}} if server re-started after being stopped [see this commit|https://github.com/apache/mina-sshd/commit/738264f423540c095bfb919d4e066721762e00ca]. Can you try the latest version (need to compile it from the [Github site|https://github.com/apache/mina-sshd]) and let us know ? Please indicate any other problems you encounter with re-starting the server (or client for that matter...) so we can fix them. > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16553394#comment-16553394 ] Jared Wiltshire commented on SSHD-340: -- I've definitely seen the issue with the server threads not stopping correctly in version 1.0.0 I've also just discovered that you can't stop an instance of SshServer then restart it again safely. This is due to the AbstractCloseable superclass which never has its state set back to State.Opened when you start it again. This means if you start SshServer after stopping it you can never stop it again. > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16493917#comment-16493917 ] Goldstein Lyor commented on SSHD-340: - I stand corrected - this means we need to review our code and locate the locations that require immediate vs. graceful close and amend them accordingly. At the same time, we need to make sure that stopping the client/server with {{immediate=true or false}} correctly propagates to the relevant sub-modules - I/O factories, sessions, channels, sub-systems, etc... > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SSHD-340) Hanging threads left working when server is shut down
[ https://issues.apache.org/jira/browse/SSHD-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16493557#comment-16493557 ] Guillaume Nodet commented on SSHD-340: -- I disagree that this is not a supported use case. When I first wrote SSHD, the main purpose is to integrate it in an OSGi environment, where bundles can be restarted at will, so this _is_ definitely a supported use case. Fwiw, the {{Closeable#close(true)}} has been created for the very purpose of closing a resource "brutally". If you want a clean shutdown, one should use {{close(false)}}. Looking at the code, I can see a few locations where this is not correctly implemented I think. For example {{Nio2ServiceFactory}} does perform a {{group.awaitTermination}} during {{doCloseImmediately()}} which is wrong. Such waits should be performed in the {{doCloseGracefully()}}. This has been introduced in 1.0.0, so it could explain why reverting to 0.10 works better for that. > Hanging threads left working when server is shut down > - > > Key: SSHD-340 > URL: https://issues.apache.org/jira/browse/SSHD-340 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 0.12.0 >Reporter: Sampo Savolainen >Priority: Major > Original Estimate: 1h > Remaining Estimate: 1h > > SSHD fails to stop properly due to errant threads. I've attached a thread > dump from a point of execution where everything should have been cleaned up. > The hanging threads happen only if the server has accepted connections and > they do not hang forever, they seem to stop themselves after a minute or so. > This might be an executor pool which is not shut down correctly. > Earlier versions (0.8.0 and 0.9.0) did not exhibit this behavior. -- This message was sent by Atlassian JIRA (v7.6.3#76005)