gpt4 book ai didi

linux - shell 中的错误粘贴导致 CPU 负载变得非常高,然后失控

转载 作者:太空宇宙 更新时间:2023-11-04 04:57:32 25 4
gpt4 key购买 nike

今天我错误地将一个字符串粘贴到我的 linux shell 中,之后 CPU 负载变得非常高,然后就失去了控制

我的环境是CentOS 6.5,我粘贴的字符串是json格式的请求日志:

[{"timestamp":1487240104178,"info":{"method":"GET","path":"/APIService/v1/refreshSession","headers":{"request":{"user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","host":"172.22.3.12:8122","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}},{"timestamp":1487240077403,"info":{"method":"GET","path":"/APIService/v1/refreshSession","headers":{"request":{"user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","host":"172.22.3.12:8122","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}},{"timestamp":1487240075185,"info":{"method":"GET","path":"/APIService/v1/refreshSession","headers":{"request":{"user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","host":"172.22.3.12:8122","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}},{"timestamp":1487240050994,"info":{"method":"GET","path":"/APIService/v1/refreshSession","headers":{"request":{"user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","host":"172.22.3.12:8122","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}},{"timestamp":1487240037110,"info":{"method":"GET","path":"/APIService/v1/refreshSession","headers":{"request":{"user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","host":"172.22.3.12:8122","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}},{"timestamp":1487240025956,"info":{"method":"GET","path":"/APIService/v1/refreshSession","headers":{"request":{"user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","host":"172.22.3.12:8122","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}},{"timestamp":1487239999461,"info":{"method":"GET","path":"/APIService/v1/refreshSession","headers":{"request":{"host":"172.22.1.15","remote_addr":"172.22.1.15","x-real-ip":"172.22.1.15","x-forwarded-for":"172.22.1.15","user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}},{"timestamp":1487239998662,"info":{"method":"GET","path":"/APIService/v1/refreshSession","headers":{"request":{"host":"172.22.1.15","remote_addr":"172.22.1.15","x-real-ip":"172.22.1.15","x-forwarded-for":"172.22.1.15","user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}},{"timestamp":1487239889129,"info":{"method":"GET","path":"/APIservice/v1/refreshSession","headers":{"request":{"host":"172.22.1.15","remote_addr":"172.22.1.15","x-real-ip":"172.22.1.15","x-forwarded-for":"172.22.1.15","user-agent":"curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2","accept":"*/*"},"response":{"X-Application-Context":"application:8122","status":"404"}}}}][root@web-01 conf]

重启后机器一切正常。

谁能告诉我发生了什么事,为什么该字符串导致如此高的 CPU 负载?

最佳答案

关于字符串末尾的[root@web-01 conf]。这是 shell 提示吗?您是否以 root 身份登录到 shell?我打你手腕!不要这样做。

我不确定,但我相信 shell 正在尝试将字符串扩展为命令,但由于字符串 */* 多次出现而碰壁。当 bash 看到 {a,b,c,*/*} 形式的字符串时,它会尝试将其扩展为字符串 a b c ...,其中 ... 是 glob */* 的扩展。当它看到嵌套的括号扩展时,它也会扩展它们。我认为你已经发生了组合爆炸。

关于linux - shell 中的错误粘贴导致 CPU 负载变得非常高,然后失控,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42272921/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com