Upload hangs at 100%
TLDR - Quick Summary
Problem: File uploads hang at 100% and never complete (pre-v3.3.5)
Config: Edit
/opt/sftpgw/sftpgateway-admin-api-{version}.confand add-DAZURE_REQUEST_WRITE_TIMEOUT=0 -DAZURE_REQUEST_READ_TIMEOUT=0 -DAZURE_REQUEST_RESPONSE_TIMEOUT=0to JAVA_OPTSApply:
service sftpgw-admin-api restart; set SFTP client timeout to 0
Overview
In recent iterations of SFTP Gateway version 3, there is an intermittent issue where a file being uploaded will hang at 100% completion and won't finish the upload transfer.
This article covers the workaround to the issue if you're not using version 3.3.5 or higher, which includes the fix.
Workaround
SSH into the VM and navigate to /opt/sftpgw.
There you will find this file:
sftpgateway-admin-api-{version}.conf
Edit this file and you will find this line:
JAVA_OPTS="-Xms256m -Xmx1024m -XX:MaxPermSize=512m -server -Daws.crt.lib.dir=/opt/sftpgw/tmp -Djava.io.tmpdir=/opt/sftpgw/tmp"
You want to change it to the following:
JAVA_OPTS="-Xms256m -Xmx1024m -XX:MaxPermSize=512m -server -Daws.crt.lib.dir=/opt/sftpgw/tmp -Djava.io.tmpdir=/opt/sftpgw/tmp -DAZURE_REQUEST_WRITE_TIMEOUT=0 -DAZURE_REQUEST_READ_TIMEOUT=0 -DAZURE_REQUEST_RESPONSE_TIMEOUT=0"
To apply these changes, restart Java:
sudo su
service sftpgw-admin-api restart
Also, you may want to set the timeout limit in your SFTP client to a large value, or 0, which for clients such as FileZilla or WinSCP means an infinite timeout.