Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jan 1999 10:14:11 -0500 (EST)
From:      Steve Spicklemire <steve@acer.spvi.com>
To:        freebsd-hackers@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG
Cc:        steve@acer.spvi.com
Subject:   Problem with libc_r ??
Message-ID:  <199901301514.KAA05625@acer.spvi.com>

next in thread | raw e-mail | index | archive | help

Hello FreeBSD Developers,

I've got a problem with threads on FreeBSD-2.2.8-STABLE. I run python
a lot on a variety of different hardware/OS combinations. Over the
holidays I cvsup'd 2.2.8 and tested it on one machine. Everything
seemed OK.. so I upgraded two others. (I still have one system running
2.2.7.) I then noticed that some cron jobs were not finishing. I've
narrowed it down to two, somehow related symptoms. All of the scripts
are run on the Python interpreter (python 1.5.1 or 1.5.2b1 show same
results). Any workarounds would be appreciated. For now I have built
a thread-disabled interpreter for cron stuff, and thread-enabled for
everything else. So long as I don't explicitly need threads in my
cron jobs.. this will work. This is just the sort of thing that 
is a pain in the neck to maintain though. ;-) 

Here are the clues:

1) If threading is enabled the problem occurs. If threading is
disabled the problem does not occur. I'm guessing that this means that
it lies in the threaded runtime system, but I don't know the details
of all that well enough to speak intelligently about it ( note that I
speak about it anyway. ;-> )

2) If more than one call is made to 'system' or 'popen' the second
call hangs. The first call seems to execute properly.

All of these scripts work fine, thread-enabled or not, from the
command line. And none of this occurs with 2.2.7. Below I've cooked up
a simple test:

crontab:
----------------------------------------------------------------------

*  *  *  *  *  /usr/local/bin/python /home/steve/it.py >> /home/steve/it.log 2>&1 &

it.py:
----------------------------------------------------------------------
import os

os.system('touch /home/steve/one.txt')

os.system('touch /home/steve/two.txt')

----------------------------------------------------------------------

When the job runs I get a 'one.txt', but no 'two.txt' in my home
directory. It's especially important to notice that I'm not
explicitly using threads in this script. Also, the python thread
module itself passes its diagnostic test when run from the 
command line or from cron. The process left hanging is always stuck in:

# gdb /usr/local/bin/python 5578
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i386-unknown-freebsd), Copyright 1996 Free Software Foundation, Inc...

/usr/home/steve/5578: No such file or directory.
Attaching to program `/usr/local/bin/python', process 5578
Reading symbols from /usr/libexec/ld.so...done.
Reading symbols from /usr/lib/libc_r.so.3.0...done.
Reading symbols from /usr/lib/libm.so.2.0...done.
Reading symbols from /usr/lib/libc.so.3.1...done.
0x2008f741 in _thread_sys_select ()
(gdb) 

It's not just a question of jobs being in the background... I tried:

python it.py &

and it worked fine... it's something about cron that doesn't work with threads
and multiple subprocesses. What can I do to further track this down?

thanks,
-steve

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901301514.KAA05625>