Our B2B application in production which was integrated with your maverick sshtools APIs (maverick-j2ssh-1.6.0 and sshd-1.6.3) had networking issues when downloading large files (1GB) from SSH Server via SFTP protocol in OpenVMS system. There were two major issues there.
Issue 1: IO error received from remotesocket closed
Note that the Ssh2Context settings almost are the default settings in this use case.
- MAJOR: The SFTP Inbound Instance [SFTP Inbound] could not process file [/TESTVOL5/000000/mvaughan/TP400TP9001GB-03.EDI;1]: com.maverick.ssh.SshIOException: IO error received from remotesocket closed [java.net.SocketException]; file is ignored and will be retried with the next scan for current originator :[TP400] and current recipient :[TP900]. [.io.agents.sftp.inbound.SFTPInboundAgent]
+MAJOR: Stacktrace of root exception com.maverick.ssh.SshIOException: IO error received from remotesocket closed [java.net.SocketException] [.io.agents.sftp.inbound.SFTPInboundAgent]
+MAJOR: at com.maverick.sftp.SftpFileInputStream.read(SftpFileInputStream.java:145) [.io.agents.sftp.inbound.SFTPInboundAgent]
+MAJOR: at java.io.InputStream.read(InputStream.java:85) [
Issue 2: IO error received from remoteSoftware caused connection abort: recv failed [java.net.SocketException]
Note1: the Ssh2Context settings are changed to the following settings.
- socketTimeout: 36000000 Milliseconds
- messageTimeout: 36000000 Milliseconds
- partialMessageTimeout:18000000 Milliseconds
- idleConnectionTimeoutSeconds: 30000 Seconds
- sendIgnorePacketOnIdle : true or false (the two settings are tested, both were the same issue)
- sessionMaxWindowSpace: 2147483647 (default) or 1073741824 (the two settings are tested, both were the same issue)
- sftpMaxWindowSpace: 2147483647 (default) or 1073741824 (the two settings are tested, both were the same issue)
Note2: the properties for SocketTransport object are test as below.
Test1: use the default settings
Test2: change to new values like
- sendBufferSize: 104857600
- receiveBufferSize: 104857600
- keepAlive: true
- soTimeout: 0 (default) or 36000000 Milliseconds
The results were that the above IO error still occurred even if I changed the setting on either Ssh2Context or SocketTransport objects.
The following are the log traces:
- MAJOR: The SFTP Inbound Instance [SFTP Inbound] could not process file [/TESTVOL5/000000/mvaughan/TP400TP9001GB-03.EDI]: com.maverick.ssh.SshIOException: IO error received from remoteSoftware caused connection abort: recv failed [java.net.SocketException]; file is ignored and will be retried with the next scan for current originator :[TP400] and current recipient :[TP900].
But if we switch the B2B application to use a SSH Server in Linux system, even if we chose the default settings for Ssh2Contect and SocketTransport object for downloading the same large file (1GB), the SFTP downloading works well. Please note that using FileZilla tool to upload and download the same file (1GB) with the SSH Server in OpenVMS system, FileZilla works fine (almost 3 hours taken for uploading and downloading) ! it is shown that the SSH server is normal without any configuration issue.
I spent a couple of days to solve these issues but not any progress on it. Looking like Maverick J2SSH API does not take any effects on different SshContext settings as expected . Do you have ideas ? Hopefully we can get your helps on solving the production B2B application issues.
I look forward to hearing your responses soon.
Thanks in advance !
Mark

Hi,
We are connecting to a remote machine using J2SSH and firing commands.
After firing each command we read the output using SessionOutputReader
object.
Most of the time it works fine but some time it is unable to read the
output.
Please help me to debug this issue?
Regards
Mukesh Negi

I've read through tons of threads on logging, most deal with Java code and not
Ant. How do I suppress the INFO messages on the console using Ant?
Also, is there a central place for documentation?
Thanks,
Jason

I encountered the same problem with version 0.2.9 and I am publishing it here as
I could not find a solution anywhere.
The problem is when the connect method is called simultaneously from multiple
threads.
One possible scenario that might cause this ConcurrentModificationException is
(depends on the values passed to the methods):
The application calls one of the com.sshtools.j2ssh.SshClient#connect methods
which eventually calls connect(SshConnectionProperties properties,
HostKeyVerification hostVerification).
The connect calls
com.sshtools.j2ssh.transport.TransportProtocolCommon#startTransportProtocol
(TransportProvider provider, SshConnectionProperties properties)
startTransportProtocol creates a com.sshtools.j2ssh.SshThread with the
TransportProtocolCommon.
TransportProtocolCommon#run() calls
TransportProtocolCommon#startBinaryPacketProtocol which calls different methods
that some use SshMsgKexInit.toString() (such as
com.sshtools.j2ssh.transport.TransportProtocolCommon#onMsgKexInit)
com.sshtools.j2ssh.transport.SshMsgKexInit has members supportedEncryptCS and
supportedEncryptSC.
Both are initialized using the method
com.sshtools.j2ssh.transport.SshMsgKexInit#sortAlgorithmList and refer to the
same static ArrayList.
The sortAlgorithmList removes and adds from the ArrayList given and if someone
calls SshMsgKexInit.toString() at the same time you will get:
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at java.util.AbstractCollection.toString(Unknown Source)
at com.sshtools.j2ssh.transport.SshMsgKexInit.toString(Unknown Source)
at
com.sshtools.j2ssh.transport.TransportProtocolClient.setLocalKexInit
(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(Unknown Source)
My current solution is to put SshClient.connect invocation in an application
scope synchronized block.

{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fswiss\fprq2\fcharset204{\*\fname Arial;}Arial CYR;}{\f1\fswiss\fcharset204{\*\fname Arial;}Arial CYR;}}
{\colortbl ;\red0\green0\blue255;\red0\green128\blue0;}
{\*\generator Msftedit 3.7.18.4288;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs32{\field{\*\fldinst{HYPERLINK "h{\*\dd 3.7.18.4288;}ttp://gamecasinovip.info"}}{\fldrslt{\ul\cf1http://gamecasinovip.info}}}\f0\cf1\b\fs32 - ONLINE CASINO!\par
\line\cf2\b\f0\fs28 VIP CLUB Casino is a great online casino that offers the unique combination of top quality games, high payouts and a 24/7 professional customer support.\par
\par100 progressive games with towering jackpots, which are ready to explode and can make multi-millionaires out of VIP CLUB players! Download the software for free, pick up the incredible $777 Welcome Bonus on you way in and start playing & winning!\par
}

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
He Almighty and seek from him that consolation in our affliction<br />
and that sanctification of our loss which he is able and willing to vouchsafe: Now, therefore, in obedience<br />
to sacred duty, and in accordance with<br />
the desire of the people, I, Chester A. Arthur, President of th <img src="cid:4BEDBCAC5928765"> e United States of America, do hereby appoint Monday next, the twenty-sixth day of September,<br />
on which day the remains of our<br />
honored and beloved dead will be consigned to their last resting-place on earth;<br />
<br />
to be observed throughout the United States as a day of humiliation and mourning; and I earnestly recommend all the people to assemble on that day in their respective places of divine worship, there to render<br />
alike their tribute of sorrowful submission to the will of Almighty God and of reverence and love for the memory and character of our late Chief Magistrate. In witness whereof I have hereunto set my hand and caused the seal of the United States to be affixed.<br />
[Sidenote: [SEAL.]] Done at the city of Washington, the twenty-second day of September, in the year of our Lord 1881, and of the independence of the United States the one hundred and sixth. CHESTER A. ARTHUR. By the President:<br />
JAMES G. BLAINE. Secretary of State.<br />
<br />
President Arthur soon showed his appreciation of the responsibilities<br />
<br />
of his new office. Knowing principles rather than<br />
<br />
persons, he subordinated individual preferences<br />
<br />
and prejudices to a well-defined public policy.<br />
<br />
While he was, as he always had been,<br />
a Republican, he had no sympathy for blind devotion<br />
to party; he had "no friends to reward, no enemies to punish;"--and he has been governed by those principles of liberty and equality which he inherited. His messages<br />
to Congress have been universally commended, and even unfriendly<br />
critics have pronounced them careful and well-matured documents. Their tone is<br />
more frank and direct than is customary in such papers, and their recommendations, extensive and varied as they have been, show that he has patiently reviewed the<br />
field of labor so sadly and so unexpectedly opened before him, and that he was not inclined to shirk the constitutional duty of aiding Congress by his suggestions<br />
and advice. An honest man, who believes in his own principles, who follows his own convictions, and<br />
who never
</body>
</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Yet in railway carriages,<br />
in which you could grill a bloater by the simple process of laying it underneath the seat, they will insist on the window being closed, light cigars to keep their noses warm, and sit with the collars of their fur coats buttoned up around their necks. In their houses they keep the double windows hermetically sealed for three or four months at a time: and<br />
<br />
the hot air quivering about the stoves scorches<br />
your face if you venture nearer to it than a yard. Travel can broaden the mind. It can also suggest to the Britisher that in some respects his countrymen are nothing near so silly as they<br />
are supposed to be. There was a time when I used to sit with my legs stretched out before the English coal fire and listen with respectful attention while people who I thought knew all about it explained to me how<br />
wicked and how wasteful were our methods. All the heat from that fire,<br />
they told me, was going up the chimney. I did not like to answer them that notwithstanding I<br />
<br />
felt warm and cosy. I feared it might be merely British stupidity<br />
that kept me warm and cosy, not the fire at all. How could it be the fire? The heat from the fire was going up the chimney. It was the glow of ignorance that was making my toes tingle. Besides, if<br />
by sitting close in front of the fire and looking hard at it, I did contrive, by hypnotic suggestion, maybe, to fancy myself warm, what should I feel like at the other end of the room? It seemed like begging the<br />
question to reply that I had no particular use for the other e <img src="cid:72463893565969"> nd of the room, that generally speaking there was room enough about the fire for all the people I really cared for, that sitting altogether round the fire seemed quite as sensible as sulking by one's self in a corner the other end of the<br />
room, that the fire made a cheerful and convenient focus for family and
</body>
</html>