Hi,
Its been a while but I think I edited HandleFileSftp.java so that it disconnected the session whenever the channel was closed and recreated it when needed.
Changed
public static Boolean closeSFTPChannel(Session session, ChannelSftp sftpChannel) {
sftpChannel.exit();
session.disconnect(); //added
return true;
}
Where ever there was
Session session = createSession(sftpConfiguration, context);
ChannelSftp sftpChannel = createSFTPChannel(session);
I changed to: -
Session session = createSession(sftpConfiguration, context);
session.connect();
Channel channel = session.openChannel("sftp");
channel.connect();
ChannelSftp sftpChannel = (ChannelSftp) channel;
I used Eclipse for the editing. Not the most efficient workaround but it worked for me.
I hope this helps
Andie
I have the same issue, looking for a fix =)
edit: this is for 6.8.1, but doesn't work on Mx 7.5.1 and 7.6.0 either
This is the stacktrace
com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.jcraft.jsch.JSchException: session is down
at com.mendix.core.component.InternalCore.execute(InternalCore.java:398)
Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.jcraft.jsch.JSchException: session is down
at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:178)
Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.jcraft.jsch.JSchException: session is down
at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:40)
Caused by: com.jcraft.jsch.JSchException: session is down
at com.jcraft.jsch.Session.openChannel(Session.java:853)
at sftpconnection.helpers.HandleFileSftp.createSFTPChannel(HandleFileSftp.java:55)
at sftpconnection.helpers.HandleFileSftp.getFileDocumentFromSFTP(HandleFileSftp.java:173)
at sftpconnection.actions.GetFileDocumentFromSFTPLocation.executeAction(GetFileDocumentFromSFTPLocation.java:50)
at sftpconnection.actions.GetFileDocumentFromSFTPLocation.executeAction(GetFileDocumentFromSFTPLocation.java:22)
at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:174)
at com.mendix.core.component.InternalCore.execute(InternalCore.java:390)
at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:52)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149)
at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:174)
at com.mendix.core.component.InternalCore.executeSync(InternalCore.java:472)
at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:43)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149)
at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:174)
at com.mendix.core.component.InternalCore.execute(InternalCore.java:390)
at com.mendix.webui.actions.client.ExecuteAction.execute(ExecuteAction.java:144)
at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply$mcV$sp(ClientRequestHandler.scala:314)
at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:304)
at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:304)
at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2$$anon$1.execute(ActionDispatching.scala:144)
at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2.apply(ActionDispatching.scala:146)
at scala.util.Try$.apply(Try.scala:192)
at com.mendix.core.session.Worker$$anonfun$receive$3.applyOrElse(ActionDispatching.scala:140)
at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
at com.mendix.core.session.Worker.aroundReceive(ActionDispatching.scala:136)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
at akka.actor.ActorCell.invoke(ActorCell.scala:487)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
at akka.dispatch.Mailbox.run(Mailbox.scala:220)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
We've started experiencing this exact same problem since last night (MX 7.5.1 application). Would appreciate any tips that may point towards a solution.
The problem is in HandleFileSftp.java. In the element createSFTPChannel the following code retrieves previous sessions:
if(userSession.containsKey(session.getUserName())){
session = userSession.get(session.getUserName());
} else{
session = ConnectSession(session);
}
The variable userSession is only set in the element setKnownHosts and in the element createSession when StrictHostkeyChecking is false. On the first try userSession variable is empty and will be filled with the current session. On the next tries it will find the old session (which is somehow not closed yet, even with the .disconnect() ) and use that session. This will eventually expire and when this happens, the message "sessioen is down" will appear.
Removing the line of code makes sure it will not happen again. I didn't check what happens when using StrictHostkeyChecking is true.
Does anyone have the updated version of the HandleFileSftp.java that accomplishes this? I'm trying to make the modification but still running into this.