Skip Menu |

This queue is for tickets about the Net-SFTP-Foreign CPAN distribution.

Report information
The Basics
Id: 81982
Status: rejected
Priority: 0/
Queue: Net-SFTP-Foreign

People
Owner: Nobody in particular
Requestors: bcovel [...] sorteogames.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bug in NET::SFTP::Foreign disconnect method
Date: Fri, 14 Dec 2012 18:41:21 +0000
To: "bug-Net-SFTP-Foreign [...] rt.cpan.org" <bug-Net-SFTP-Foreign [...] rt.cpan.org>
From: Borden Covel <bcovel [...] sorteogames.com>
I am using NET::SFTP::Foreign in a Windows service. We use plink and are running on Windows Server 2003 R2 / Standard Edition / SP2. When the service tries to reset the connection by destroying the NET::SFTP::Foreign object the disconnect method in Foreign.pm tries to kill the child plink process. This code has not been working. In order to make it work all I had to do was to break one statement up into two. The code was : if ($windows) { kill KILL => $pid and waitpid($pid, 0); } And was changed to: if ($windows) { $debug and $debug & 4 and _debug("ready to kill $pid."); my $cnt = kill KILL => $pid; $debug and $debug & 4 and _debug ( "$cnt process(s) killed." ); if ( $cnt ) { my $p = waitpid($pid, 0); $debug and $debug & 4 and _debug("waitpid returned $p."); } } Borden Covel Consultant to Sorteo Games
El Vie Dic 14 13:41:31 2012, bcovel@sorteogames.com escribió: Show quoted text
> I am using NET::SFTP::Foreign in a Windows service. We use plink and > are running on Windows Server 2003 R2 / Standard Edition / SP2. > > When the service tries to reset the connection by destroying the > NET::SFTP::Foreign object the disconnect method in Foreign.pm tries > to kill the child plink process. This code has not been working. In > order to make it work all I had to do was to break one statement up > into two. The code was : > > if ($windows) { > kill KILL => $pid > and waitpid($pid, 0); > } > > And was changed to: > > if ($windows) > { > $debug and $debug & 4 and _debug("ready to kill $pid."); > my $cnt = kill KILL => $pid; > $debug and $debug & 4 and _debug ( "$cnt process(s) killed." ); > if ( $cnt ) > { > my $p = waitpid($pid, 0); > $debug and $debug & 4 and _debug("waitpid returned $p."); > } > } > > Borden Covel > Consultant to Sorteo Games
Hi, Both pieces of code are equivalent, the only possible explanation for your version working is some race condition going on under the hood. In that case, breaking the code in two sentences will only make the problem less likely to happen. Does your solution work with debugging dissabled? In any case, have you considering using the Net::SSH2 backend (Net::SFTP::Foreign::Backend::Net_SSH2 in CPAN) instead of plink?
Subject: RE: [rt.cpan.org #81982] bug in NET::SFTP::Foreign disconnect method
Date: Fri, 14 Dec 2012 20:46:51 +0000
To: "bug-Net-SFTP-Foreign [...] rt.cpan.org" <bug-Net-SFTP-Foreign [...] rt.cpan.org>
From: Borden Covel <bcovel [...] sorteogames.com>
Salvador - Thank you so much for your amazingly quick response. I would concur with your thoughts about a race condition, so perhaps there is an underlying Perl issue. However, I've been running the new code without debugging enabled in my test environment (it resets my SFTP connection every 15 minutes) for the past few hours and it has been working without error. The code I am working on is a couple of years old. We've had intermittent connection problems from the beginning but only just recently were able to pin it down to fact that the plink process was not being killed correctly. The orphaned plink processes continue to have an open connection to the SFTP server and after a while the SFTP server refuses to accept any more connections. I have not tried NET_SSH2. I am not in a position to be able to make drastic changes at this time but am hoping to be able to move my code to Linux sometime in future and will look at it then. I also noticed that it is listed as experimental. How stable it is? Thanks, Borden Show quoted text
-----Original Message----- From: Salvador Fandino Garcia via RT [mailto:bug-Net-SFTP-Foreign@rt.cpan.org] Sent: Friday, December 14, 2012 11:13 AM To: Borden Covel Subject: [rt.cpan.org #81982] bug in NET::SFTP::Foreign disconnect method <URL: https://rt.cpan.org/Ticket/Display.html?id=81982 > El Vie Dic 14 13:41:31 2012, bcovel@sorteogames.com escribió:
> I am using NET::SFTP::Foreign in a Windows service. We use plink and > are running on Windows Server 2003 R2 / Standard Edition / SP2. > > When the service tries to reset the connection by destroying the > NET::SFTP::Foreign object the disconnect method in Foreign.pm tries > to kill the child plink process. This code has not been working. In > order to make it work all I had to do was to break one statement up > into two. The code was : > > if ($windows) { > kill KILL => $pid > and waitpid($pid, 0); > } > > And was changed to: > > if ($windows) > { > $debug and $debug & 4 and _debug("ready to kill $pid."); > my $cnt = kill KILL => $pid; > $debug and $debug & 4 and _debug ( "$cnt process(s) killed." ); > if ( $cnt ) > { > my $p = waitpid($pid, 0); > $debug and $debug & 4 and _debug("waitpid returned $p."); > } > } > > Borden Covel > Consultant to Sorteo Games
Hi, Both pieces of code are equivalent, the only possible explanation for your version working is some race condition going on under the hood. In that case, breaking the code in two sentences will only make the problem less likely to happen. Does your solution work with debugging dissabled? In any case, have you considering using the Net::SSH2 backend (Net::SFTP::Foreign::Backend::Net_SSH2 in CPAN) instead of plink? ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.2805 / Virus Database: 2634/5953 - Release Date: 12/12/12
More information is required to determine the root of the problem and fix it.