程序经常卡死,定位了半天才定位到原因,原来是Popen导致的卡死: 程序如下: s = subprocess.Popen([*,*,*], stdout=subprocess.PIPE) ret = s.stdout.read() return ret 官方文档的解释是: This will deadlock when using stdout=PIPE and/or stderr=PIPE and the child process generates enough output to a p
[mysql@mysqlhq scripts]$ cat /etc/redhat-release Kylin Linux release 3.3.1707 (Core) mysql version Server version: 5.6.15-log MySQL Community Server - (GPL) 1 初始情况 [root@mysqlhq scripts]# free -m total used free shared buff/cache available Mem: 15887
python 版本 2.5.4 (在高版本python中提倡使用 subprocess.Popen 取代 os.popen) os.popen 会出现过长时间等待导致阻塞问题, 解决方法如下: [python] view plain copy print? def TIMEOUT_COMMAND(command, timeout): """call shell-command and either return its output or kill it if it does