[issue1731717] race condition in subprocess module

2010-03-08 Thread Yonas

Yonas yona...@gmail.com added the comment:

Florent,

Have you tested any of the sample test programs mentioned in this bug report? 
For example, the one by Joel Martin (kanaka).

I'd suggest to test those first before marking this issue as fixed.

- Yonas

--
status: pending - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1731717] race condition in subprocess module

2010-03-08 Thread Yonas

Yonas yona...@gmail.com added the comment:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/9a853d0308c8e55a


I'm also glad to see a test case that causes exactly the same error with or 
without the presence of a ‘daemon.DaemonContext’.

Further research shows that handling of ‘SIGCLD’ (or ‘SIGCLD’) is fairly
OS-specific, with “ignore it” or “handle it specifically” being correct
on different systems. I think Python's default handling of this signal
is already good (modulo bug #1731717 to be addressed in ‘subprocess’).

So I will apply a change similar to Joel Martin's suggestion, to default
to avoid touching the ‘SIGCLD’ signal at all, and with extra notes in
the documentation that anyone using child processes needs to be wary of
signal handling.

This causes the above test case to succeed; the output file contains:: 
=
Child process via os.system.
Child process via 'subprocess.Popen'.
Parent daemon process.
Parent daemon process done.
=

  -- By Ben Finney

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1731717] race condition in subprocess module

2010-03-08 Thread Yonas

Yonas yona...@gmail.com added the comment:

Ben Finney's comment suggests to me that this bug is being ignored. Am I wrong?

with extra notes in the documentation that anyone using child processes needs 
to be wary of signal handling.

Why should they be wary? We should just fix this bug.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1731717] race condition in subprocess module

2010-03-08 Thread Yonas

Yonas yona...@gmail.com added the comment:

By the way, in three months from today, this bug will be 3 years old.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1731717] race condition in subprocess module

2010-03-08 Thread Yonas

Yonas yona...@gmail.com added the comment:

Gregory,

Awesome! Approx. how long until we hear back from you in this report?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1731717] race condition in subprocess module

2009-05-31 Thread Yonas

Yonas yona...@gmail.com added the comment:

To test with exim4 is easy. To reproduce on Ubuntu Jaunty:

1. apt-get install exim4-daemon-heavy

2. echo local_scan = /usr/lib/exim4/local_scan/libpyexim.so 
/etc/exim4/conf.d/main/15_py-exim_plugin_path

3. cd /usr/lib/exim4/local_scan

4. Compile mylib, output will be libpyexim.so:

gcc `python2.6-config --cflags` -c -fPIC mylib.c -o mylib.o 
gcc -Xlinker -export-dynamic -lpython2.6 -lnsl -lpthread -ldl -lutil -lm
-lz -shared -Wl,-soname,libpyexim.so -o libpyexim.so  mylib.o

5. Restart server:
/etc/init.d/exim4 restart

6. Send some mail:
cat mail.txt | sendmail -t

(contents of mail.txt):
Content-type: text/plain
To: your_usern...@localhost
From: foo...@example.com
Subject: test

Hello world.

--
status: pending - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1731717] race condition in subprocess module

2009-05-31 Thread Yonas

Yonas yona...@gmail.com added the comment:

Also, copy exim_local_scan2.py to /usr/lib/python2.6/

--
Added file: http://bugs.python.org/file14134/exim_local_scan2.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue1731717] race condition in subprocess module

2009-05-31 Thread Yonas

Yonas yona...@gmail.com added the comment:

I'm assuming that exim4 is reading config files from /etc/exim4/conf.d/*.

To make sure, you can enforce split file mode by running `sudo
dpkg-reconfigure exim4-config`. It should be one of the last questions
present to you.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1731717] race condition in subprocess module

2009-05-27 Thread Yonas

Yonas yona...@gmail.com added the comment:

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

Example library and main program are attached.

--
nosy: +yonas
Added file: http://bugs.python.org/file14086/mylib.c

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1731717] race condition in subprocess module

2009-05-27 Thread Yonas

Changes by Yonas yona...@gmail.com:


Added file: http://bugs.python.org/file14087/main.c

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1731717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] [Errno 10] No child processes

2009-05-27 Thread Yonas

New submission from Yonas yona...@gmail.com:

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.

--
files: mylib.c
messages: 88407
nosy: yonas
severity: normal
status: open
title: [Errno 10] No child processes
versions: Python 2.6
Added file: http://bugs.python.org/file14088/mylib.c

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] [Errno 10] No child processes

2009-05-27 Thread Yonas

Changes by Yonas yona...@gmail.com:


Added file: http://bugs.python.org/file14089/main.c

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Changes by Yonas yona...@gmail.com:


--
title: [Errno 10] No child processes - OSError: [Errno 10] No child processes

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Changes by Yonas yona...@gmail.com:


--
type:  - crash

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Yonas yona...@gmail.com added the comment:

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.

--
Added file: http://bugs.python.org/file14094/exim_local_scan2.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Yonas yona...@gmail.com added the comment:

Thanks for testing, it works when running ./main, but not when run
through exim.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Yonas yona...@gmail.com added the comment:

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().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Yonas yona...@gmail.com added the comment:

Could this be a permissions issue? I have no idea how permissions would
effect it, though...

r...@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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Yonas yona...@gmail.com added the comment:

os.system() works:

os.system(echo `date`  /tmp/myfile)

r...@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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Yonas yona...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6122] OSError: [Errno 10] No child processes

2009-05-27 Thread Yonas

Changes by Yonas yona...@gmail.com:


--
versions: +Python 2.5, Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4434] Embedding into a shared library fails

2009-05-21 Thread Yonas

Yonas yona...@gmail.com added the comment:

Ralf,

Linking against the static library (with '-Xlinker -export-dynamic') did
_not_ solve the problem for me.

gcc `python2.6-config --cflags` -c -fPIC mylib.c -o mylib.o -Xlinker
-export-dynamic

gcc -Xlinker -export-dynamic -lpthread -ldl -lutil -lm -lz -shared
-Wl,-soname,mylib.so -o mylib.so  mylib.o 
/usr/lib/python2.6/config/libpython2.6.a

gcc `python2.6-config --cflags` -Xlinker -export-dynamic -ldl -lutil -lm
-lz  -o main main.c /usr/lib/python2.6/config/libpython2.6.a
--

`python2.6-config --cflags` returns
-I/usr/include/python2.6 -I/usr/include/python2.6 -fno-strict-aliasing
-DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes


Ubuntu Jaunty
Linux yonas-laptop 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59
UTC 2009 i686 GNU/Linux

--
nosy: +yonas

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4434
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4434] Embedding into a shared library fails

2009-05-21 Thread Yonas

Yonas yona...@gmail.com added the comment:

Same error message: 

import dl: ImportError: /usr/lib/python2.6/lib-dynload/dl.so: undefined
symbol: PyExc_ValueError

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4434
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4434] Embedding into a shared library fails

2009-05-21 Thread Yonas

Yonas yona...@gmail.com added the comment:

Here's my log file (`LD_DEBUG=all ./main`)

--
Added file: http://bugs.python.org/file14033/log-main.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4434
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4434] Embedding into a shared library fails

2009-05-21 Thread Yonas

Changes by Yonas yona...@gmail.com:


Removed file: http://bugs.python.org/file14033/log-main.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4434
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4434] Embedding into a shared library fails

2009-05-21 Thread Yonas

Yonas yona...@gmail.com added the comment:

Updated log file.

--
Added file: http://bugs.python.org/file14034/log-main.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4434
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4434] Embedding into a shared library fails

2009-05-21 Thread Yonas

Yonas yona...@gmail.com added the comment:

rb's workaround works, though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4434
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com