Difficult Python thread problem on AIX SMP machine

Gardner Pomper gardner at networknow.org
Wed Nov 12 10:09:45 EST 2003


Hi,

I am pretty new to python, so be gentle :)

I have a python script that spawns a number of threads (configurable) on a
12 processor AIX RISC-6000 machine. It works fine, so long as I am running
less than 5 threads. With more than 5, I get errors, but only on AIX, not
on Linux.

The python script is fairly simple, because each thread just spawns a korn
shell script. I actually get the error in the shell script, not in python,
but I think it may be python related, because I don't get the error when I
run the whole thing as a korn shell script.

Basically, each thread does:

 pipe0_ = os.popen( 't.ksh 2>&1', 'r')
 text0_ = pipe0_.read()
 sts0_ = pipe0_.close()`

to spawn a shell script (t.ksh) that does:

   cd subdir
   ls -l
   exit $?

There is a different subdir for each thread.

This works fine, so long as I am running less than 5 threads. But once I
run more than that, I start getting an error from the script:

sh: /home/gpomper/tmp/t8/thread.ksh: 0403-015 Cannot access a required
executable file. It is in use.

This problem only occurs on AIX. It runs fine on my Red Hat 9.0 machine.

I have tried to find what that AIX error means, with no luck. My problem
is made more difficult, because I try to simulate the error by writing a
korn shell script that basically does this:

t.ksh &
t.ksh &
t.ksh &
... 
t.ksh &

repeated 20 times, and modify t.ksh so that it loops 100 time, so that I
can guarantee that all the processes are running simultaneously. When I
try this, I don't get the error.

Unfortunately, this makes AIX tech support think that this is a python
issue, not an AIX issue.

I would be *extremely* grateful for helpful suggestions.

- Gardner





More information about the Python-list mailing list