I am trying to open a new subprocess which will take a few input files and generate the output in other file. While this runs cleanly most of the times, when I am trying to do some stress testing this fails and gives me the following error trace:
我正在尝试打开一个新的子进程,它将获取一些输入文件并在其他文件中生成输出。当我在尝试做一些压力测试时,这个过程大部分时间都是干净的,但是它却给了我以下的错误信息:
File "/home/admin/Workspace/.metadata/.plugins/org.eclipse.pde.core/pde-junit/org.eclipse.osgipython/util/media_info.py", line 161, in external_process
process = subprocess.Popen(command, shell=shell, close_fds=True, stderr=subprocess.PIPE)
File "/usr/local/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/local/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 7] Argument list too long
Initially I thought that the command that I was passing(it was the absolute path of 4 files) was longer than the OS could support. But even after reducing the absolute path passed to 1/4th of the original value. I still get this error. Please note that I don't get this error all the time. Mostly its after a 1000 or more runs while the path length remains the same for all cases.
最初,我认为我传递的命令(它是4个文件的绝对路径)比OS支持的时间长。但即使将绝对路径减少到原始值的1/4。我仍然会得到这个错误。请注意,我一直没有得到这个错误。大多数情况下,当路径长度保持不变时,它会运行1000次或更多。
1 个解决方案
#1
2
strace is your friend. Throw in a -s 2048 to see what's really happening. Knowing C will help you read this, but you can still pick out long exec* strings without C knowledge.
strace是你的朋友。扔进-s 2048,看看到底发生了什么。知道C可以帮助你阅读这篇文章,但你仍然可以在没有C知识的情况下挑选出很长的exec*字符串。
http://stromberg.dnsalias.org/ ~ strombrg / debugging-with-syscall-tracers.html