You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2021/03/23 07:50:06 UTC

[mina-sshd] branch master updated (f58f006 -> 2fc98f7)

This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git.


    from f58f006  [SSHD-1123] Provide configurable behavior for ChannelAsyncOutputStream chunking behavior
     new 1832863  [SSHD-1148] Generate a unique thread name for each SftpSubsystem instance
     new 2fc98f7  [SSHD-1148] Provide unique thread names to single threaded executors

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.md                                                           | 3 ++-
 sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java  | 3 ++-
 .../src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java   | 2 +-
 .../src/main/java/org/apache/sshd/client/channel/ChannelSession.java | 2 +-
 .../java/org/apache/sshd/server/command/AbstractCommandSupport.java  | 3 ++-
 .../src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java     | 5 +++--
 6 files changed, 11 insertions(+), 7 deletions(-)

[mina-sshd] 02/02: [SSHD-1148] Provide unique thread names to single threaded executors

Posted by lg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 2fc98f7a21a7b83d2b2bc72d48a2194caa7f8fd1
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Tue Mar 23 09:49:33 2021 +0200

    [SSHD-1148] Provide unique thread names to single threaded executors
---
 sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java    | 3 ++-
 .../src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java     | 2 +-
 .../src/main/java/org/apache/sshd/client/channel/ChannelSession.java   | 2 +-
 .../java/org/apache/sshd/server/command/AbstractCommandSupport.java    | 3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java b/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java
index 4a55cdf..34efa40 100644
--- a/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java
+++ b/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java
@@ -162,7 +162,8 @@ public final class SshFsMounter extends SshServerCliSupport {
 
         @Override
         public void start(ChannelSession channel, Environment env) throws IOException {
-            executor = ThreadUtils.newSingleThreadExecutor(getClass().getSimpleName());
+            executor = ThreadUtils.newSingleThreadExecutor(
+                    getClass().getSimpleName() + "-" + Math.abs(System.nanoTime() & 0xFFFF));
             future = executor.submit(this);
         }
 
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
index a187f67..d885329 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
@@ -83,7 +83,7 @@ public class AgentServerProxy extends AbstractLoggingBean implements SshAgentSer
             }
 
             pipeService = (executor == null)
-                    ? ThreadUtils.newSingleThreadExecutor("sshd-AgentServerProxy-PIPE-" + authSocket)
+                    ? ThreadUtils.newSingleThreadExecutor("AgentServerProxy-PIPE-" + authSocket)
                     : ThreadUtils.noClose(executor);
             piper = pipeService.submit(() -> {
                 try {
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
index 9178ba2..4d5548e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
@@ -94,7 +94,7 @@ public class ChannelSession extends AbstractClientChannel {
                 CloseableExecutorService service = getExecutorService();
                 if (service == null) {
                     pumperService = ThreadUtils.newSingleThreadExecutor(
-                            "ClientInputStreamPump[" + this + "]");
+                            "ClientInputStreamPump[" + Math.abs(System.nanoTime() & 0xFFFF) + "]");
                 } else {
                     pumperService = ThreadUtils.noClose(service);
                 }
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java b/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java
index b09bf4d..55dc4a7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java
@@ -68,7 +68,8 @@ public abstract class AbstractCommandSupport
             String poolName = GenericUtils.isEmpty(command)
                     ? getClass().getSimpleName()
                     : command.replace(' ', '_').replace('/', ':');
-            this.executorService = ThreadUtils.newSingleThreadExecutor(poolName);
+            this.executorService = ThreadUtils.newSingleThreadExecutor(
+                    poolName + "-" + Math.abs(System.nanoTime() & 0xFFFF));
         } else {
             this.executorService = executorService;
         }

[mina-sshd] 01/02: [SSHD-1148] Generate a unique thread name for each SftpSubsystem instance

Posted by lg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 183286327a2212f8a7cb7c7fcb3c7372e4d50ef7
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Tue Mar 23 09:30:39 2021 +0200

    [SSHD-1148] Generate a unique thread name for each SftpSubsystem instance
---
 CHANGES.md                                                           | 3 ++-
 .../src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java     | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 8db2755..0255d8d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -30,6 +30,7 @@
 * [SSHD-1111](https://issues.apache.org/jira/browse/SSHD-1111) Fixed SshClientCliSupport compression option detection
 * [SSHD-1125](https://issues.apache.org/jira/browse/SSHD-1125) Added option to require immediate close of channel in command `ExitCallback` invocation
 * [SSHD-1127](https://issues.apache.org/jira/browse/SSHD-1127) Consolidated `SftpSubsystem` support implementations into `SftpSubsystemConfigurator`
+* [SSHD-1148](https://issues.apache.org/jira/browse/SSHD-1148) Generate a unique thread name for each `SftpSubsystem` instance
 
 ## Behavioral changes and enhancements
 
@@ -49,4 +50,4 @@
 * [SSHD-1127](https://issues.apache.org/jira/browse/SSHD-1127) Added capability to register a custom receiver for SFTP STDERR channel raw or stream data
 * [SSHD-1133](https://issues.apache.org/jira/browse/SSHD-1133) Added capability to specify a custom charset for parsing incoming commands to the `ScpShell`
 * [SSHD-1133](https://issues.apache.org/jira/browse/SSHD-1133) Added capability to specify a custom charset for returning environment variables related data from the `ScpShell`
-* [SSHD-1133](https://issues.apache.org/jira/browse/SSHD-1133) Added capability to specify a custom charset for handling the SCP protocol textual commands and responses
\ No newline at end of file
+* [SSHD-1133](https://issues.apache.org/jira/browse/SSHD-1133) Added capability to specify a custom charset for handling the SCP protocol textual commands and responses
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
index 923ff94..c18714d 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
@@ -88,7 +88,6 @@ public class SftpSubsystem
         extends AbstractSftpSubsystemHelper
         implements Command, Runnable, FileSystemAware, ExecutorServiceCarrier,
         AsyncCommand, ChannelDataReceiver {
-
     protected static final Buffer CLOSE = new ByteArrayBuffer(null, 0, 0);
 
     protected final AtomicBoolean closed = new AtomicBoolean(false);
@@ -122,7 +121,9 @@ public class SftpSubsystem
 
         CloseableExecutorService executorService = configurator.getExecutorService();
         if (executorService == null) {
-            this.executorService = ThreadUtils.newSingleThreadExecutor(getClass().getSimpleName());
+            // See SSHD-1148 - use different thread name for concurrently running instances
+            this.executorService = ThreadUtils.newSingleThreadExecutor(
+                    getClass().getSimpleName() + "-" + Math.abs(System.nanoTime() & 0xFFFF));
         } else {
             this.executorService = executorService;
         }