jsch


Hundreds of Apache SSHD clients leave hundreds of OpenSSH daemon processes running


I use a the Apache SSHD java library's client to serve files over HTTP that are read via SSH. The concept app works great.
But when I want to read hundreds of files serially (e.g. to display images in a gallery) I run into scalability problems: my server ends up with hundreds of OpenSSH daemon processes:
under my username as /usr/lib/openssh/sftp-server and
sshd:username#notty, and
under root as sshd: username [priv]
which causes my server to run out of memory and my server to crash.
I don't think this is a bug in OpenSSH (I'm using OpenSSH_5.9p1), but how I'm using the Apache SSHD client.
Here is the code I run every time I serve a file:
SshClient client = SshClient.setUpDefaultClient();
client.getProperties().put(ClientFactoryManager.HEARTBEAT_INTERVAL, "50000");
client.start();
session = client.connect("username", "server", 22).await().getSession();
session.addPasswordIdentity("password");
session.auth().await();
SftpClient sftp = session.createSftpClient();
// Create an HTTP response from an sftp channel stream
Which of the following, if any, do I need to make hundreds of JSch client requests?
Close/stop my session and/or client after each request? (the
terminology here is so generic yet the functionality is so precise
that I may have wrong understanding of each component)?
Client pooling?
Server configuration to limit the number of daemon threads?
Reduce the timeout (on the client or on the server)?
Any insight, specific or general, would be helpful.
You definitely must disconnect your SSH/SFTP session after your are done with it:
client.stop();
Client pooling is not bad idea, but you do it only after disconnecting does not help.

Related Links

Decreased speeds when using JSch put compared to scp
JSCH Channel Is Not Opened (New)
What the situation will make channel.getExitStatus() return 1
JSch read local log file
JSCH setCommand is not working
com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 11 No appropriate prime between 1024 and 1024 is available. en
I'm trying to use Jsch to establish an SSH connection in Java.I got the Exception com.jcraft.jsch.jschexception unknownhostkey
com.jcraft.jsch.JSchException: failed to send sftp request
JSch for pbrun not working
JSCH read from input stream hangs from time to time
Hundreds of Apache SSHD clients leave hundreds of OpenSSH daemon processes running
Jsch - ssh connection through ssh tunnel
Changing password using Jsch and ChannelExec
how to delete local file using jsch after file is sent to remote SFTP server directory
com.jcraft.jsch.JSchException: Auth fail error
Creating a new file in SSH enabled system using JSCH

Categories

HOME
netsuite
keycloak
activiti
tizen
octobercms
jsp-tags
cvs
filtering
amazon-ecs
frameworks
blueprintjs
enterprise-library-5
mouse
append
session-variables
python-unittest
gz
size
quickfix
decimal
caml
django-simple-history
uitypeeditor
systemc
tostring
http-status-code-504
visual-composer
nas
kryo
xlsxwriter
physics-engine
firebase-crash-reporting
spark-jobserver
log4js-node
jaxb2
microsoft-chart-controls
fabric8
iframe-resizer
bosh
google-cloud-endpoints-v2
http-get
catch-all
webtest
caret
accelerate-framework
android-nestedscrollview
gammu
amazon-kinesis-kpl
dynamics-crm-2013
objectlistview
jna
webdriver-manager
greenrobot-eventbus
unixodbc
acoustics
user-accounts
flickr-api
hibernate-tools
strptime
upstart
typescript1.8
domain-model
dotnetzip
imanage
eventkit
color-picker
vmware-tools
hover-over
yaws
independentsoft
netmq
phpcas
hsv
tcpserver
intellij-14
quicklisp
drawbitmap
tableau-online
microbenchmark
createprocessasuser
unity3d-gui
c3
jquery-layout
rebol3
hippomocks
mysqltuner
quantlib-swig
dataservice
rdoc
manchester-syntax
dbproviderfactories
pendrive
deobfuscation
xtype
self-extracting
disclosure
mongomapper
remember-me
html-input
radcombobox
mirah
multi-tier
kdbg
photoshop-cs4
aquaticprime
port-number
misv

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App