We can confirm on our side that the workaround you suggested works:
- set the queue_size to 1 in the constructor parameters which makes the upload a lot slower.
Example:
use Net::SFTP::Foreign;
my $host = 'sftp.MyAwsTransferSFTPservice.com';
my $sftp = Net::SFTP::Foreign->new($host, more => queue_size => 1);
Thank You
From: Dimitar Kolev
Sent: Friday, October 4, 2019 6:06 AM
To: bug-Net-SFTP-Foreign@rt.cpan.org
Cc: Oleg Kashansky <okashansky@acats.com>
Subject: RE: [rt.cpan.org #130641] Couldn't write to remote file: bad packet sequence with net-sftp-foreign
Also posted at
https://forums.aws.amazon.com/thread.jspa?messageID=918460󠎼
to verify that AWS SFTP server can process request out of order.
We will try the workaround and bug report you requested.
Thanks
From: Salvador \"Fandiño\" via RT <bug-Net-SFTP-Foreign@rt.cpan.org<mailto:bug-Net-SFTP-Foreign@rt.cpan.org>>
Sent: Friday, October 4, 2019 5:22 AM
To: Dimitar Kolev <dkolev@acats.com<mailto:dkolev@acats.com>>
Subject: Re: [rt.cpan.org #130641] Couldn't write to remote file: bad packet sequence with net-sftp-foreign
[[EXTERNAL EMAIL]]
<URL:
https://rt.cpan.org/Ticket/Display.html?id=130641<
https://rt.cpan.org/Ticket/Display.html?id=130641> >
It seems that AWS SFTP server can process request out of order. It is allowed by the standard, but so far, no implementation has ever done that and Net::SFTP::Foreign was dependent on it not happening.
As a work around, you can set queue_size to 1 on the constructor. Transfers would be much slower, but successful.
It that doesn't work, enable debugging and attach the output to the bug report.
$Net::SFTP::Foreign::debug = -1;
On Thursday, October 3, 2019, 6:33:52 PM GMT+2, Dimitar Kolev via RT <bug-Net-SFTP-Foreign@rt.cpan.org<mailto:bug-Net-SFTP-Foreign@rt.cpan.org>> wrote:
Thu Oct 03 11:17:25 2019: Request 130641 was acted upon.
Transaction: Ticket created by dkolev@acats.com<mailto:dkolev@acats.com>
Queue: Net-SFTP-Foreign
Subject: Couldn't write to remote file: bad packet sequence with net-sftp-foreign
Broken in: (no value)
Severity: (no value)
Owner: Nobody
Requestors: dkolev@acats.com<mailto:dkolev@acats.com>
Status: new
Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=130641<
https://rt.cpan.org/Ticket/Display.html?id=130641> >
Hello,
We are utilizing SFTP client net-sftp-foreign
http://manpages.ubuntu.com/manpages/bionic/man3/Net::SFTP::Foreign.3pm.html<
http://manpages.ubuntu.com/manpages/bionic/man3/Net::SFTP::Foreign.3pm.html> , with perl v5.26.1 on Ubuntu 18.04.2
The general process used is to build an array of the files that are waiting to be sent, then connect to the AWS SFTP Transfer service, and then loop through the array,
if ( !$remoteConnection->put( $localFile, $remoteFileName, copy_perm => 0, copy_time => 0 ) ) {
$error = 1;
&broadcast( $remoteConnection->error );
}
We get 100% upload failure with larger than 34KB files:
09/26/2019 10:41:41 Connection to sftp.MyAWSsFTPservice.com successful.
09/26/2019 10:41:41 Uploading file: 20190925_ABC.XYZ
09/26/2019 10:41:41 Couldn't write to remote file: bad packet sequence, expected 2, got 3
09/26/2019 10:41:41 Could not upload 20190925_ABC.XYZ
09/26/2019 10:41:41 Uploading file: 20190925_ABC.RST
09/26/2019 10:41:41 Connection to remote server stalled
Would you verify that the 'net-sftp-foreign' client is working with AWS SFTP Service?
Not sure if it is a bug in the module or AWS SFTP Service itself.
The exact same code works fine with other SFTP Servers like CerberusFTP.
I created tickets with AWS too:
https://forums.aws.amazon.com/thread.jspa?threadID=310692<
https://forums.aws.amazon.com/thread.jspa?threadID=310692>
Dimitar G. Kolev
ACA Surveillance Technology | Sr. Product Engineer
1370 Broadway, 12th Floor
New York, NY 10018
Office 212-951-1030 x1094 | Mobile 917-946-4844
dkolev@acats.com<mailto:dkolev@acats.com<mailto:dkolev@acats.com%3cmailto:dkolev@acats.com>>
www.acatechnologysolutions.com<
http://www.acatechnologysolutions.com><
http://www.acatechnologysolutions.com/<
http://www.acatechnologysolutions.com/>>
Follow us: LinkedIn<
http://www.linkedin.com/company/aca-compliance-group<
http://www.linkedin.com/company/aca-compliance-group>> | Twitter<
https://twitter.com/ACACompliance<
https://twitter.com/ACACompliance>> @ACACompliance
[ACA Technology Solutions]<
http://www.acacompliancegroup.com/aca-technology-solutions<
http://www.acacompliancegroup.com/aca-technology-solutions>>
This message is intended only for the designated recipient(s). It may contain confidential, privileged or proprietary information. If you are not a designated recipient, you may not review, copy or distribute this message. If you receive this message in error, please notify the sender by reply email and delete this message. Thank you.