bash - Cygwin 的 bash 在出错后变得非常慢

标签 bash cygwin

我知道还有一些关于为什么 Cygwin 显然很慢的其他问题,但这种情况似乎是独一无二的。

我遇到了一些问题,报告了很多错误,然后在重新启动后,从 bash 启动的任何进程都非常慢。老实说,我不知道是什么原因造成的(我检查了 taskmgr 中的进程优先级;它仍然正常)。

详细信息:

我整夜对一些套接字代码进行浸泡测试,早上回来发现我的屏幕充满了错误(对话框 - 主要是试图访问 NULL 指针)以及发送到命令行的相当多的东西。有相当多的文本我无法捕获(计算机几乎没有响应;我不得不手动重新启动它)。我确实记得一些引用“Win32 错误 6”的文本(我假设这意味着 INVALID HANDLE)。

重启后,大多数情况都很好,但 Cygwin/bash 仍然没有响应。按照另一个问题的建议,我运行了以下命令:

$ time for i in {1..10} ; do bash -c "echo Hello" ; done
...
real    1m12.244s
user    0m3.522s
sys     0m34.460s

为了可怕的速度,调用另一个 bash 实例不是必需的:

$ time for i in {1..10}; do ls ; done    
# nb there are about 6 entries in pwd
....
real    0m47.718s
user    0m2.568s
sys     0m23.411s

虽然内置函数看起来确实运行得足够快:

$ time for i in {1..10} ; do echo Hello ; done
....
real    0m0.001s
user    0m0.000s
sys     0m0.000s

更新: 我刚刚意识到从那时到现在也安装了 Windows 更新。我很高兴这不会变得太复杂或任何事情。 (不过,我相信其他同事已经安装了更新并且没有发现问题)。

更新 2:

为了回答下面的评论,/bin 中的文件从 CMD 执行时没有任何问题。另外,我完全删除并重新下载了我的cygwin安装目录,问题仍然存在。

我 [仍然] 不完全确定如何使用 Cygwin 的 strace,但我认为第一列可能是时间增量。考虑到这一点,这里有几行看起来有问题(0xDEADBEEF 肯定不令人鼓舞):

4100175 4101564 [main] bash 5664 _cygtls::remove: wait 0xFFFFFFFF
4278898 4279724 [main] bash 5612 child_copy: dll bss - hp 0x628 low 0x611DC000, high 0x612108D0, res 1
2210923 25635973 [proc_waiter] bash 5664 pinfo::maybe_set_exit_code_from_windows: pid 5400, exit value - old 0x8000000, windows 0xDEADBEEF, cygwin 0x8000000
3595425 16085618 [proc_waiter] bash 5612 pinfo::maybe_set_exit_code_from_windows: pid 5376, exit value - old 0x8000000, windows 0xDEADBEEF, cygwin 0x8000000
3057452 19149209 [proc_waiter] bash 5664 pinfo::maybe_set_exit_code_from_windows: pid 5612, exit value - old 0x8000000, windows 0xDEADBEEF, cygwin 0x8000000
2631997 38835042 [proc_waiter] bash 5716 pinfo::maybe_set_exit_code_from_windows: pid 5720, exit value - old 0x8000000, windows 0xDEADBEEF, cygwin 0x8000000
2610852 38836658 [main] bash 4624 _cygtls::remove: wait 0xFFFFFFFF
3708283 42556365 [proc_waiter] bash 5716 pinfo::maybe_set_exit_code_from_windows: pid 4624, exit value - old 0x8000000, windows 0xDEADBEEF, cygwin 0x8000000
3666884 42562053 [main] bash 5664 fhandler_base_overlapped::wait_overlapped: GetOverLappedResult failed, bytes 0
2742397 45305871 [proc_waiter] bash 5664 pinfo::maybe_set_exit_code_from_windows: pid 5716, exit value - old 0x8000000, windows 0xDEADBEEF, cygwin 0x8000000
45322195 45322997 [main] bash 3996 child_copy: dll bss - hp 0x62C low 0x611DC000, high 0x612108D0, res 1
4247577 49581019 [main] bash 3996 _cygtls::remove: wait 0xFFFFFFFF
4266690 49581325 [main] bash 5664 child_info::sync: pid 3996, WFMO returned 0, res 1
49622099 49623318 [main] bash 4840 child_copy: dll bss - hp 0x690 low 0x611DC000, high 0x612108D0, res 1
4225718 53860809 [main] bash 4840 _cygtls::remove: wait 0xFFFFFFFF
4248491 53861119 [main] bash 3996 child_info::sync: pid 4840, WFMO returned 0, res 1
2167422 2169463 [main] bash 1412 _cygtls::remove: wait 0xFFFFFFFF
10369 2205831 [main] bash 1412 pwdgrp::load: \etc\passwd curr_lines 4082
10313 2237148 [main] bash 1412 cygwin_gethostname: name A119894
14720 2251868 [main] bash 1412 stat64: entering

最佳答案

我有一个类似的问题,通过删除断开连接的网络共享来解决。

http://cygwin.com/faq/faq-nochunks.html#faq.using.slow
http://cygwin.com/ml/cygwin/2010-06/msg00510.html (阅读所有回复)

你也可以看看这个:

http://cygwin.com/acronyms/#BLODA

gl

关于bash - Cygwin 的 bash 在出错后变得非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7533806/

相关文章:

linux - 在 bash (awk) 中导入新文件时删除点和斜杠

c++ - android ndk 和 cygwin

c++ - boost::asio::acceptor 在 win7 上挂起

linux - 列出并更改目录并在 Shell 中运行命令

linux - Bash "declare -A"在 macOS 上不工作

linux - 如果未指定文件,为什么 grep 不起作用?

regex - 使用 sed 删除子字符串

linux - 如何在 Linux 中按名称获取文件的完整路径

cygwin - screen 和 Cygwin : no tab completion?

windows - Babun 或 Cygwin 与 meteor