New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFTP File Reader gets stuck in Polling state. Must be halted and restarted. #4142
Comments
Thanks Tony! I would like to add, I also saw this issue in 3.5.0 Imported Comment. Original Details: |
Surefire way to reproduce: Setup an SFTP container: Create a File Writer to write to it: Set a breakpoint at FileDispatcher:166, right after the line
On the 9th time, the breakpoint won't be reached, and instead your File Writer will be hung until you halt it. Verify with a threaddump:
Imported Comment. Original Details: |
See forum post https://www.mirthcorp.com/community/forums/showthread.php?t=11371 for history of issue.
All of the seemingly unrelated errors have to do with the server terminating the connection. My thread dump showed that the Jsch session thread was not running when the channel was stuck polling.
After 8 occurances of these errors is when the channel gets stuck. org.apache.commons.pool2.impl.GenericObjectPoolConfig.DEFAULT_MAX_TOTAL is also 8.
The issue appears to be in the releaseConnection method of com.mirth.connect.connectors.file.FileConnector. If the FileSystemConnection is not connected, it neither returns it to the pool nor invalidates it.
I was able to verify this with the following code:
`
var donkey = com.mirth.connect.donkey.server.Donkey.getInstance();
var stuckChannel = '9113f3c3-2024-424e-8916-592ec983a822';
var channel = donkey.getDeployedChannels().get(stuckChannel);
var sourceConnector = channel.getSourceConnector();
var f = sourceConnector.getClass().getDeclaredField("fileConnector");
f.setAccessible(true);
var fileConnector = f.get(sourceConnector);
f = fileConnector.getClass().getDeclaredField("pools");
f.setAccessible(true);
var pools = f.get(fileConnector);
var pool = pools.values().iterator().next();
logger.info(JSON.stringify({
pool:{
getNumIdle: pool.getNumIdle(),
getNumActive: pool.getNumActive(),
getNumWaiters: pool.getNumWaiters()
}
}));
Which logged the following when my channel was stuck:
INFO (deploy:?): {"pool":{"getNumIdle":0,"getNumActive":8,"getNumWaiters":1I was able to reproduce this in a test environment by setting up a sftp server with artifical network delay. Once the file reader started reading a file I would kill the sftp server to sever the connection and then restart the sftp server. After 8 iterations of this the channel was stuck in a polling state.
Imported Issue. Original Details:
Jira Issue Key: MIRTH-4266
Reporter: agermano
Created: 2018-05-02T20:24:27.000-0700
The text was updated successfully, but these errors were encountered: