We get such a com.jcraft.jsch.JSchException: verify: false when we want to...
Status: Alpha
Brought to you by:
ymnk
Hi Team,
We are getting com.jcraft.jsch.JSchException: verify: false exception Intermittently with latest version (0.1.55) JSCH. Where it is claimed to fixed in 0.1.50.
com.jcraft.jsch.JSchException: verify: false
at com.jcraft.jsch.Session.connect(Session.java:307)
at com.jcraft.jsch.Session.connect(Session.java:160)
Please have a look.
This looks very much like a threading issue since the reproduction is so unpredictable. For a while, I thought this was caused by our own app threads, or a failure of the library to protect itself from being used in a multithreaded context. But, as my test case evolved, it became apparent that it was not our use of threads causing the problem. I synchronized all the JSch calls so that only a single one of our threads can use the lib at a time, and it still reproduced.
Since app threads are reduced to one at a time as far as JSch is concerned, and this looks very much like a multithreading issue, it is likely an issue caused by the threads JSch is using internally.
https://github.com/is/jsch/search?q=thread
I'm attaching a concatenation of the files needed for reproduction in the form of a TestNG test. There is also a diagnostic class in there to get a snapshot of what different threads are doing. If you aren't using TestNG, it should be pretty straightforward to extract the parts you need.