homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: OSError: [Errno 10] No child processes
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6, Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: race condition in subprocess module
View: 1731717
Assigned To: Nosy List: amaury.forgeotdarc, flox, yonas
Priority: normal Keywords:

Created on 2009年05月27日 08:12 by yonas, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mylib.c yonas, 2009年05月27日 08:12
main.c yonas, 2009年05月27日 08:12
exim_local_scan2.py yonas, 2009年05月27日 16:50
Messages (10)
msg88407 - (view) Author: Yonas (yonas) Date: 2009年05月27日 08:12
I always get a subprocess error when using embedded Python 2.6.2:
File "/usr/lib/python2.6/subprocess.py", line 1123, in wait: pid,
sts = os.waitpid(self.pid, 0): OSError: [Errno 10] No child processes
Sample library and main files attached.
msg88408 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009年05月27日 08:36
The content of exim_local_scan2.py would be useful as well.
msg88422 - (view) Author: Yonas (yonas) Date: 2009年05月27日 16:50
The test doesn't fail when run directly from ./main, but it fails when
run from exim4 mail server. 
exim will dlopen() mylib and run local_scan().
Besides using Popen, I haven't had any problems.
msg88423 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009年05月27日 17:28
your program works for me.
How did you compile the files? I used the following commands:
$ gcc -fPIC -I/usr/local/include/python2.6/ mylib.c -L /usr/local/lib
-lpython2.6 --shared -o mylib.so
$ gcc main.c -ldl 
$ ./a.out
test
(after removing all references to exim4, which is not really used)
msg88424 - (view) Author: Yonas (yonas) Date: 2009年05月27日 17:44
Thanks for testing, it works when running ./main, but not when run
through exim.
msg88426 - (view) Author: Yonas (yonas) Date: 2009年05月27日 18:17
I didn't find anything unusual about how exim uses dlopen, but if you
want to see the code, it's here:
http://pastebin.com/m52398b30
Line 166 is the actual call.
Again, no problems except with Python's Popen().
msg88433 - (view) Author: Yonas (yonas) Date: 2009年05月27日 19:37
Could this be a permissions issue? I have no idea how permissions would
effect it, though...
root@yonas-laptop:/usr/lib/exim4/local_scan# ls -la /usr/sbin/exim4
-rwsr-xr-x 1 root root 824440 2009年02月11日 08:53 /usr/sbin/exim4
msg88440 - (view) Author: Yonas (yonas) Date: 2009年05月27日 20:06
os.system() works:
os.system("echo `date` >> /tmp/myfile")
root@yonas-laptop:/usr/lib/exim4/local_scan# cat /tmp/myfile 
Wed May 27 16:04:54 EDT 2009
Wed May 27 16:04:54 EDT 2009
msg88442 - (view) Author: Yonas (yonas) Date: 2009年05月27日 20:52
Here's another test, taken from the docs:
http://docs.python.org/library/subprocess.html#subprocess-replacements:
This is slightly better than Popen because the program executes and
shows output, but worse than os.system(), because it still shows the error:
--------------------------
try:
 retcode = call("echo" + " \"hello world\"", shell=True)
 if retcode < 0:
 print >>sys.stderr, "Child was terminated by signal",
-retcode
 print >>sys.stderr, "Child was terminated by signal",
-retcode
 else:
 print >>sys.stderr, "Child returned", retcode
 except OSError, e:
 print >>sys.stderr, "Execution failed:", e
-----------------
hello world
Execution failed: [Errno 10] No child processes
msg100431 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010年03月04日 22:58
Another duplicate of #1731717 
History
Date User Action Args
2022年04月11日 14:56:49adminsetgithub: 50372
2010年03月04日 22:58:08floxsetstatus: open -> closed
priority: normal
superseder: race condition in subprocess module


nosy: + flox
messages: + msg100431
resolution: duplicate
2009年05月27日 20:59:53yonassetversions: + Python 2.5, Python 3.0
2009年05月27日 20:52:46yonassetmessages: + msg88442
2009年05月27日 20:06:39yonassetmessages: + msg88440
2009年05月27日 19:37:19yonassetmessages: + msg88433
2009年05月27日 18:17:40yonassetmessages: + msg88426
2009年05月27日 17:44:55yonassetmessages: + msg88424
2009年05月27日 17:28:40amaury.forgeotdarcsetmessages: + msg88423
2009年05月27日 16:50:50yonassetfiles: + exim_local_scan2.py

messages: + msg88422
2009年05月27日 12:27:11r.david.murraysettype: crash -> behavior
components: + Library (Lib)
2009年05月27日 08:36:58amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg88408
2009年05月27日 08:13:32yonassettype: crash
2009年05月27日 08:13:00yonassettitle: [Errno 10] No child processes -> OSError: [Errno 10] No child processes
2009年05月27日 08:12:25yonassetfiles: + main.c
2009年05月27日 08:12:14yonascreate

AltStyle によって変換されたページ (->オリジナル) /