0

I'm using midnight commander with Cygwin 64 bit on Windows 10 64 bit.

After moving to a new machine and a clean reinstall of windows and cygwin, my midnight commander started to get very laggy from time to time. Restarting helps, but this happens too often for that to be a viable solution (restarting doesn't help).

I have no idea what could be the reason for these hiccups. MC normally works fine: arrow presses work well, viewing and editing is instant, but one thing takes up to 10 seconds - changing directories. Searching in files has a similar lag, but only once (ie not in every chdir it could have done). In non-mc cygwin usage this issue doesn't happen.

The task manager doesn't show any abnormally high CPU or memory usage on any process. I have cygserver running, using bash as my shell and have no fancy PS1 settings, my $CYGWIN is only winsymlinks:native.

Here is a strace log, maybe someone has an idea what did go wrong? http://pastebin.pl/view/9b839815
(recorded with LOCALE=C strace -q -o /tmp/mc-log mc /tmp)

In the recorded session I have:

  • started mc in /tmp directory
  • entered /tmp/NVIDIA Corporation directory
  • went back up (..)
  • entered /tmp/mc-chanibal directory
  • went back up (..)
  • exited with F10

Additional timing information:

A find of all directories in my $HOME takes 4.6 seconds:

$ time find ~ -type d | wc -l
(snipped two directories without permissions)
19919

real    0m4.626s
user    0m0.796s
sys     0m3.765s

A ls -al on all of these directories took a lot of time, but the average was fairly low:

time (find ~ -type d | while read f; do { time ls -al $f; } \
   |& awk '$1 == "real" { printf $2 }'                      \
   | awk -Fm '{printf( "%2.4f", $1 * 60 + $2 )}';           \
   echo -e "\t$f"; done                                     \
) >/tmp/ls-time-log ;
(snipped two dirs without permissions)

real    12m21.870s
user    7m4.576s
sys     16m34.446s

The average time to do an ls -al is 0.020s, min is 0.017, max is 0.154:

$ awk 'BEGIN { sum=0; min=9999; max=0;  minf=""; maxf=""; }     \
      $1 { sum += $1;                                           \
           if(min > $1) { min = $1; minf = $2; };               \
           if(max < $1) { max = $1; maxf = $2; } }              \
      END { print "avg: " sum/NR; print "min: " min " "         \
          minf; print "max: " max " " maxf }' </tmp/ls-time-log
avg: 0.0204292
min: 0.0170 /cygdrive/c/Users/chanibal/AppData/Roaming/OculusClient/Local
max: 0.1540 /cygdrive/c/Users/chanibal/AppData/Local/Android/sdk/platforms/android-23/data/res/drawable-hdpi

With the overhead of measuring time it averages 16m34s/19919 = 0.499s per call to ls -al, two awks and a iteration of find. Not very good, but not four seconds.


Normalizing with cygpath doesn't take long:

$ time strace cygpath -aw /tmp/NVIDIA\ Corporation/ | grep normalize_posix_path
  116   11175 [main] cygpath 3524 normalize_posix_path: src /tmp/NVIDIA Corporation/
   20   11195 [main] cygpath 3524 normalize_posix_path: /tmp/NVIDIA Corporation/ = normalize_posix_path (/tmp/NVIDIA Corporation/)

real    0m0.034s
user    0m0.015s
sys     0m0.000s

EDIT: Added this issue to MC's trac

  • Is it a domain machine or stand alone ? – matzeri Jul 6 '16 at 17:39
  • $ grep normalize_posix_path 9b839815.strace | awk '{ if ($1 > 10000) print $0}' shows a 4 seconds timeout entering some directories. Any unusual SID on file ACLs ? Can you compare with the time to run ls -l on the same directories ? – matzeri Jul 7 '16 at 4:40
  • @matzeri: this is a stand alone windows installation, no network drives attached or domain controller – Krzysztof Bociurko Jul 7 '16 at 8:34
  • @matzeri: time of ls -al on the directory or it's contents is negligible (around real 0.021s) – Krzysztof Bociurko Jul 7 '16 at 8:35
  • @matzeri: added a lot of detailed timing in question – Krzysztof Bociurko Jul 7 '16 at 10:06
0

I have found the issue and decided it's Windows 10 or faulty hardware fault, not MC. Midnight commander does trigger this issue, but it does so by using the OS in expected ways, so it's not its fault.

To be exact, the issue is that enumerating devices takes time (exactly 4 or 5 seconds in Windows powershell or 4 seconds in Cygwin). The fix in my case was to disable the DVD drive that was taking time. Details on the Cygwin mailing list thread.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.