Hi,
We are facing some issues due to SFTP service hang . We have some services which calls custom java service for sftp login … So sometimes if login serivce gets hang then its parent flow service also gets hang. We have to manually kill the services everytime. There are multiple services which are using same java service for sftp login and all these gets hang. as all are trying to connect to same server. Checked with client but they are saying there is no issue at their end and other users are not facing any issue.It is happening atleast once in a week. To avoid this i added timeout in channel.connect and session.connect method for timeput in java serivce but it didnt work and problem remained same.
Parent flow service
—>sftpLogIn (java service) (i have set timeout for this service’s property also and inside the java code set timeout also)
---->sftp:cd
Java service
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String ftpHost = IDataUtil.getString( pipelineCursor, "ftpHost" );
int ftpPort = Integer.parseInt(IDataUtil.getString( pipelineCursor, "ftpPort" ));
String ftpUserName = IDataUtil.getString( pipelineCursor, "ftpUserName" );
String ftpPassword = IDataUtil.getString( pipelineCursor, "ftpPassword" );
pipelineCursor.destroy();
String status = null;
//First Create a JSch session
System.out.println("Creating session.");
JSch jsch = new JSch();
Session session = null;
Channel channel = null;
ChannelSftp c = null;
//
try {
//Create a session sending through our username and password
session = jsch.getSession(ftpUserName, ftpHost, ftpPort);
session.setPassword(ftpPassword);
//Security.addProvider(new com.sun.crypto.provider.SunJCE());
//Setup Strict HostKeyChecking to no so we dont get the
//unknown host key exception
//
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
//session.connect();
session.connect(60000);
//
//Open the SFTP channel
//
channel = session.openChannel("sftp");
// channel.connect();
channel.connect(60000);
c = (ChannelSftp)channel;
status = "OK";
}
catch (Exception e) {
status = "Unable to connect to FTP server. "+e.toString();
}
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, "ChannelSftp", c );
IDataUtil.put( pipelineCursor_1, "SessionFactory", session );
IDataUtil.put(pipelineCursor_1, "status", status);
pipelineCursor.destroy();
Can anyone please tell how can i set some timeout so that parent service doesnt get hang.Even i tried to set timeout in parent service for java service as 120 seconds but that also didnt work.