public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin commands are intermittently hanging on Windows
@ 2022-11-07 22:06 Derek Pagel
  2022-11-08  0:24 ` Takashi Yano
  0 siblings, 1 reply; 12+ messages in thread
From: Derek Pagel @ 2022-11-07 22:06 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 2463 bytes --]

We've been encountering Cygwin commands that are intermittently hanging on Windows. We don't have any predictable way to reproduce it besides running commands in a loop until we encounter a hang. So, we've created a script that will loop and execute 5 different Cygwin commands (touch, cp, mv, which, and rm) and log any commands that take longer than a second. The script is set to loop 10,000 times which gives a handful of instances of hangs in the log that have taken anywhere from 10-200 seconds to complete. Has anyone else encountered hangs from Cygwin commands?

I've printed the script below for reference:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
use strict;
use Cwd;

my $TESTDIR = getcwd() . "\\test<file://test>";
my $MKDIRCMD = "mkdir test";
my $TOUCHCMD = 'touch test.txt';
my $CPCMD = 'cp test.txt test2.txt';
my $MVCMD = "mv test.txt " . $TESTDIR . "\\test.txt<file://test.txt>";
my $WHICHCMD = 'which explorer.exe';
my $RMCMD = "rm " . $TESTDIR . "\\test.txt test2.txt<file://test.txt%20test2.txt>";
my $count = 0;
my $fh;
my $LOG = open $fh, '>', 'cygwinTest.log';

if ( ! -e $TESTDIR ) {
                runCMD($MKDIRCMD, 0);
}

while ($count < 10000) {
                print "Loop $count:\n";
                runCMD($TOUCHCMD, $count);
                runCMD($CPCMD, $count);
                runCMD($MVCMD, $count);
                runCMD($WHICHCMD, $count);
                runCMD($RMCMD, $count);
                $count++;
}

sub runCMD {
                my $CMD = $_[0];
                my $COUNT = $_[1];
                my $retCode;
                my $startTime;
                my $endTime;
                my $totalTime;

                $startTime = time();
                $CMD = "C:\\Windows\\system32\\cmd.exe /c $CMD";
                $retCode = system($CMD);
                $endTime = time();
                $totalTime = $endTime - $startTime;
                if ($totalTime > 1 ) {
                                print $fh "Loop #$COUNT:\n";
                                if ($retCode == 0) {
                                                print $fh "It took $totalTime seconds to run [$CMD]\n";
                                } else {
                                                print $fh "It took $totalTime seconds to unsuccesfully run [$CMD]\n";
                                }
                }
}

close $fh;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-11-25 21:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 22:06 Cygwin commands are intermittently hanging on Windows Derek Pagel
2022-11-08  0:24 ` Takashi Yano
2022-11-08 13:25   ` Derek Pagel
2022-11-08 15:41     ` Takashi Yano
2022-11-08 16:00       ` Derek Pagel
2022-11-08 16:50         ` Takashi Yano
2022-11-08 17:17           ` Derek Pagel
2022-11-08 17:24             ` Takashi Yano
2022-11-08 18:11               ` Derek Pagel
2022-11-22 13:23                 ` Derek Pagel
2022-11-16 17:19               ` Derek Pagel
2022-11-25 21:54                 ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).