SFTP service hang issue

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.

try to use:
session.connect();
session.setTimeout(Integer.parseInt(timeout));
in your code

Hi,

session.connect();
session.setTimeout(60000);

and

session.connect(60000); is same thing. both didnt work for me. Is there any other option. Kindly suggest.

Can anyone please help… :frowning:

Hi Prerna,
Which webmethods version are you using? As per my knowledge service timeout does not work properly in version 8 and older versions. From version 8.2 it works properly.

Regards,
Vikas

Do you have any FTP connection timeout global settings in the Extended Setting on the IS?

What is your IS version? Did you try use OpenSSH for SFTP implementation?

HTH,
RMG

Hi All

Iam facing the similar issue, could someone please share the resolution/fix for this jsch login hanging issue.
In my case, after sending 20files(in sequence) login thread started hanging for 21st file forever.

Hi,

can you please provide some more details please?

Are you using built-in sftp feature (available since 9.5)?
Which exact wM version are you on? Any Fixes applied?

Please provide an outline of your service (where do you place the loop over the files?):
login
put
logout

Regards,
Holger