Share

SSHTools

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

fix failing multithreaded SshClient#connect

You are viewing a single message from this topic. View all messages.

  1. ggc

    2009-01-28 13:29:58 UTC
    There is changing of shared (static) data when invoking SshClient#connect, because SshCipherFactory#getSupportCiphers doesn't copy the returned list (as other similar calls from SshMsgKexInit#<init> do). Here's a patch, and follows the exception I received because of that bug.

    --- src/com/sshtools/j2ssh/transport/cipher/SshCipherFactory.java 2007-04-28 21:02:54.000000000 +0200
    +++ src/com/sshtools/j2ssh/transport/cipher/SshCipherFactory.java 2009-01-28 14:15:25.000000000 +0100
    @@ -139,7 +139,7 @@
    */
    public static List getSupportedCiphers() {
    // Return the list
    - return supported;
    + return new ArrayList(supported);
    }

    /**

    The exception:

    ERROR [Transport protocol 4] TransportProtocolCommon:?(run) - The Transport Protocol thread failed
    java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at java.util.ArrayList.add(ArrayList.java:372)
    at com.sshtools.j2ssh.transport.SshMsgKexInit.sortAlgorithmList(Unknown Source)
    at com.sshtools.j2ssh.transport.SshMsgKexInit.<init>(Unknown Source)
    at com.sshtools.j2ssh.transport.TransportProtocolCommon.createLocalKexInit(Unknown Source)
    at com.sshtools.j2ssh.transport.TransportProtocolCommon.sendKeyExchangeInit(Unknown Source)
    at com.sshtools.j2ssh.transport.TransportProtocolCommon.startBinaryPacketProtocol(Unknown Source)
    at com.sshtools.j2ssh.transport.TransportProtocolCommon.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:595)

    triggering

    SFTP connection failure: exception: com.sshtools.j2ssh.transport.TransportProtocolException: The connection did not complete at:
    com.sshtools.j2ssh.transport.TransportProtocolClient.onStartTransportProtocol(Unknown Source)
    com.sshtools.j2ssh.transport.TransportProtocolCommon.startTransportProtocol(Unknown Source)
    com.sshtools.j2ssh.SshClient.connect(Unknown Source)
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.