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

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
How to interact with the script after its execution using Jsch

Categories

HOME
google-chrome-extension
fft
read-eval-print-loop
rsyslog
routes
rubygems
umd
disassembler
pivotal-cloud-foundry
onelogin
bs4
add
basic
medical
cloudkit
kibana-4
midi
resize
systemc
seaborn
django-admin
ab-testing
scichart
nodatime
jprofiler
jtextfield
grails3
custom-wordpress-pages
wkwebview
crosstab
windows-error-reporting
elasticsearch-net
unboundid
google-rich-snippets
directx-10
yadcf
subset-sum
xmlreader
ghost4j
overlap
dosbox
serve
neuroscience
leading-zero
elasticsearch-plugin
lumberjack
grid.mvc
texmaker
mime
netcdf4
businessworks
wptoolkit
babel-core
upstart
errordocument
pnotify
idisposable
np-complete
arrow-keys
nbconvert
infix-notation
home-directory
multiple-regression
pervasive-sql
wso2cloud
intel-fortran
cartesian-product
teamcity-8.0
dukescript
responsive-images
arcanist
createprocessasuser
codeigniter-url
google-style-guide
mdt
client-side-templating
yorick
oracle-warehouse-builder
srs
page-layout
oam
buster.js
back-stack
hungarian-algorithm
e4x
rdoc
runas
parametric-equations
semantic-diff
adk
window-management
nsobject
coredump
psi
sql-server-profiler
mongomapper
gamequery
castle-monorail
thunderbird-lightning
ctp4
simpletest
yagni
sector
post-build
dbisam

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App