Skip to content

KeepAlive threads don't die if authPassword fails #506

@adagios

Description

@adagios

When there's an EOF during authPassword(), the KeepAlive thread is not stopped, and because the transport is not running, just keeps sleeping on an infinite loop.

An example of the logs I'm seeing:

2019-04-11 23:50:38,839 ERROR [[reader]] (()) net.schmizz.sshj.transport.TransportImpl : Dying because - Broken transport; encountered EOF
net.schmizz.sshj.transport.TransportException: Broken transport; encountered EOF
        at net.schmizz.sshj.transport.Reader.run(Reader.java:59)
2019-04-11 23:50:38,839  INFO [[reader]] (()) net.schmizz.sshj.transport.TransportImpl : Disconnected - UNKNOWN
2019-04-11 23:50:38,843 ERROR [[interact-486]] (()) net.schmizz.concurrent.Promise : <<authenticated>> woke to: net.schmizz.sshj.userauth.UserAuthException: Broken transport; encountered EOF

I'm trying to work around it by switching the order of autoPassword and turning the KeepAlive on, from the order given in the KeepAlive example:

client.connect(ip, port);
client.getConnection().getKeepAlive().setKeepAliveInterval(timeoutInSeconds);
client.authPassword(user, password);

to

client.connect(ip, port);
client.authPassword(user, password);
client.getConnection().getKeepAlive().setKeepAliveInterval(timeoutInSeconds);

will update when I find out the results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions