Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Authentication in progress! #94

Open
ext-marko-parikka opened this issue May 29, 2024 · 2 comments
Open

Comments

@ext-marko-parikka
Copy link

We are running java application to move files from one place to another periodically by using Spring @scheduled annotation. In test environment, we are executing the process every minute. The process checks if there are files to be moved.

In this test case, there are no files at all to be moved. The sshclient is created like this:

SshClientBuilder.create()
          .addIdentities(sshKeyPair)
          .withHostname(host)
          .withPort(port)
          .withUsername(username)
          .build();

And sftp client like this: SftpClientBuilder.create().withClient(sshClient).build()

Once and a while this happens:
`29 May 2024 09:00:01,141 [ pool-746-thread-1] ERROR - Connection task failed with an error
java.lang.IllegalStateException: Authentication in progress!
at com.sshtools.client.AuthenticationProtocolClient.doNextAuthentication(AuthenticationProtocolClient.java:270)
at com.sshtools.client.AuthenticationProtocolClient.processMessage(AuthenticationProtocolClient.java:205)
at com.sshtools.synergy.ssh.TransportProtocol$5.doTask(TransportProtocol.java:2103)
at com.sshtools.common.ssh.ConnectionAwareTask.run(ConnectionAwareTask.java:49)
at com.sshtools.common.ssh.ExecutorOperationSupport$OperationTask.executeAllTasks(ExecutorOperationSupport.java:134)
at com.sshtools.common.ssh.ExecutorOperationSupport$OperationTask.run(ExecutorOperationSupport.java:89)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

29 May 2024 09:13:01,114 [ pool-751-thread-1] ERROR - Connection task failed with an error
java.lang.IllegalStateException: Authentication in progress!
at com.sshtools.client.AuthenticationProtocolClient.doNextAuthentication(AuthenticationProtocolClient.java:270)
at com.sshtools.client.AuthenticationProtocolClient.processMessage(AuthenticationProtocolClient.java:205)
at com.sshtools.synergy.ssh.TransportProtocol$5.doTask(TransportProtocol.java:2103)
at com.sshtools.common.ssh.ConnectionAwareTask.run(ConnectionAwareTask.java:49)
at com.sshtools.common.ssh.ExecutorOperationSupport$OperationTask.executeAllTasks(ExecutorOperationSupport.java:134)
at com.sshtools.common.ssh.ExecutorOperationSupport$OperationTask.run(ExecutorOperationSupport.java:89)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

29 May 2024 09:21:01,108 [ pool-755-thread-1] ERROR - Connection task failed with an error
java.lang.IllegalStateException: Authentication in progress!
at com.sshtools.client.AuthenticationProtocolClient.doNextAuthentication(AuthenticationProtocolClient.java:270)
at com.sshtools.client.AuthenticationProtocolClient.processMessage(AuthenticationProtocolClient.java:205)
at com.sshtools.synergy.ssh.TransportProtocol$5.doTask(TransportProtocol.java:2103)
at com.sshtools.common.ssh.ConnectionAwareTask.run(ConnectionAwareTask.java:49)
at com.sshtools.common.ssh.ExecutorOperationSupport$OperationTask.executeAllTasks(ExecutorOperationSupport.java:134)
at com.sshtools.common.ssh.ExecutorOperationSupport$OperationTask.run(ExecutorOperationSupport.java:89)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)`

And when I check the code, it should never happen:
if (currentAuthenticator != null) { // should never happen throw new IllegalStateException("Authentication in progress!"); }

@ext-marko-parikka
Copy link
Author

These errors started to occur when we started to use version: 3.1.1. With 3.0.11 version, we did not face these kind of exceptions.

@mr-mister123
Copy link

Yes, it has to do with a fix i proposed for issue 82.

now the problem happens much less often (authentication failed) but when it happens, it will result in that exception, since there is still an race-condition anywhere. i will dig deeper into it in the next days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants