Winscp.exe hangs after Winscp.com is closed

Advertisement

rmundkowsky
Joined:
Posts:
6

Winscp.exe hangs after Winscp.com is closed

Hi,

I use WinSCP with automated scripts. Winscp.exe somethings fails to close and then no more sessions of Winscp.exe can be run on the box (or at least under that user). The problem occurs intermittently. This problem has occurred with version 4.0.6 and even the 4.1.3 beta. It is not clear what happens that causes this. I have tried to create a monitor process to fix this problem, but Winscp forks or spawns and there is no way to get all of process ids.

I have noted that this problem is easy to replicate with a simple Perl script (note problem seems to occur 50% of the time this script is called. I tried /log and got no output.

O.k., so here Perl script the script file:

##script file named tt
## note this is designed to keep Winscp.exe up so it can be killed
option batch on
option batch abort
option confirm off
lcd c:\temp
lls

##Perl (ActivePerl 5.8.8) control script
use Win32::Process;

$executable='c:\Program Files\WinSCP\WinSCP.com';
$Args='/console /script=tt /log=c:\temp\foo';
$Pid=0;

sub ErrorReport
{
print Win32::FormatMessage( Win32::GetLastError() );
}

Win32::Spawn( $executable, $Args, $Pid );

sleep 3;

Win32::Process::KillProcess($Pid, $exitcode) || die ErrorReport();

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Winscp.exe hangs after Winscp.com is closed

When you kill winscp.com, I would not expect that winscp.exe gets closed.
But from your post I've understood that winscp.exe does not close even if winscp.com closes regularly (e.g. using exit command). Is it correct?

Reply with quote

rmundkowsky
Joined:
Posts:
6

Correct

Hi,

Not sure why this thread got closed. I think it is still an open question.

Anyways, yes the Winscp sometimes hangs when it is not killed. It is not clear if it hangs on exit or during a transfer. This problem only happens about 1 out of 100 times. I don't have any logs for this scenerio.

As for Winscp.exe not closing when Winscp.com is killed, hmm, that seems like a bug to me. I don't know how you spawn or fork Winscp.exe from Winscp.com, but proper behavior of anything started from Winscp.com is to exit when Winscp.com is killed. Think about it, if I use Winscp.com then I have the process ID for it and not for Winscp.exe. I should only have to kill the Winscp.com process. Right now I found a work around which is to kill the whole tree or at least all of the child processes I have, but this should not be required.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Correct

rmundkowsky wrote:

Not sure why this thread got closed. I think it is still an open question.
The thread was never closed.

Anyways, yes the Winscp sometimes hangs when it is not killed. It is not clear if it hangs on exit or during a transfer. This problem only happens about 1 out of 100 times. I don't have any logs for this scenerio.
Are you able to get the logs?

As for Winscp.exe not closing when Winscp.com is killed, hmm, that seems like a bug to me. I don't know how you spawn or fork Winscp.exe from Winscp.com, but proper behavior of anything started from Winscp.com is to exit when Winscp.com is killed. Think about it, if I use Winscp.com then I have the process ID for it and not for Winscp.exe. I should only have to kill the Winscp.com process. Right now I found a work around which is to kill the whole tree or at least all of the child processes I have, but this should not be required.
I do not know if Windows support this mechanism at all, but I'll investigate and implement it, if possible. This issue has been added to tracker.

Reply with quote

rmundkowsky
Joined:
Posts:
6

Re: Correct

Thanks for your efforts.

>> Are you able to get the logs?

I'll try to get you a copy in the future when the error occurs again.

I was logging STDOUT (not /log) and if I remember correctly there was log showed either:
- Got to transfer step in script
- Log showed nothing, not even login to the server

Reply with quote

Advertisement

You can post new topics in this forum