You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perl -MNet::SFTP::Foreign -lE 'use Net::SFTP::Foreign::Constants qw(:flags); my $sftp = Net::SFTP::Foreign->new("localhost"); my $fh = $sftp->open("/tmp/test-pls-delete", SSH2_FXF_WRITE|SSH2_FXF_CREAT|SSH2_FXF_TRUNC) or die $sftp->error; print $fh "x"x1000; kill('HUP',$sftp->{pid}); for (1..100_000) { print $fh "x"x1000 or die "print failed" };'
or pretty formatted:
#!/usr/bin/env perl
use Net::SFTP::Foreign;
use Net::SFTP::Foreign::Constants qw(:flags);
my $sftp = Net::SFTP::Foreign->new("localhost");
my $fh =
$sftp->open( "/tmp/test-pls-delete",
SSH2_FXF_WRITE | SSH2_FXF_CREAT | SSH2_FXF_TRUNC )
or die $sftp->error;
print $fh "x" x 1000;
# loosing ssh process results in memory over allocation somewhere in write()
kill( 'HUP', $sftp->{pid} );
for ( 1 .. 100_000 ) {
print $fh "x" x 1000 or die "print failed";
}
kill( 'HUP', $sftp->{pid} ); line triggers lost-connection conditions, without it script would create ~100MB file in /tmp.
Quick work-around is to set autodie=1.
Would be good if write()/print() functions will return fail in case of broken connection and at the same time not overfill message buffers.
Best regards
Jozef
The text was updated successfully, but these errors were encountered:
Hello, thank you for the quick fix! I've tested locally right away → works good. I'll be able to test on our staging servers following week with real traffic.
Hello,
one-liner that will allocate gigabytes of memory:
or pretty formatted:
kill( 'HUP', $sftp->{pid} );
line triggers lost-connection conditions, without it script would create ~100MB file in /tmp.Quick work-around is to set autodie=1.
Would be good if write()/print() functions will return fail in case of broken connection and at the same time not overfill message buffers.
Best regards
Jozef
The text was updated successfully, but these errors were encountered: