- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
今天我错误地将一个字符串粘贴到我的 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/
我在 android 代码中使用 asmack XMPP。我可以正常登录 XMPP 服务器,但是当我尝试创建新用户时出现问题。我想要实现的是: 以管理员身份登录。 创建一个新用户。 从管理员注销。 以
这是我的标记页面,其中有一个按钮可以从数据库中搜索数据并显示在网格中 这是我背后的代码 if (!IsPostBack) { LblInfo.Text = "Page Load
当我多次将相同的 float 值插入到我的集合中时,本应花费恒定时间的 x in s 检查变得非常慢。为什么? 时序x in s的输出: 0.06 microseconds 0.09 mi
我有一个小型聊天客户端,可以将所有历史记录存储在 sqlite 数据库中。当用户单击我的应用程序中的 history 选项卡时,我的应用程序会获取所有相关历史记录并将其显示在 QWebView 中。我
我是一名优秀的程序员,十分优秀!