Reputation: 393
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.
Upvotes: 4
Views: 4735
Reputation: 2909
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.
http://stromberg.dnsalias.org/~strombrg/debugging-with-syscall-tracers.html
Upvotes: 2