Python 2.3.3 signals, threads & extensions: signal handling problem

Python 2.3.3 signals, threads & extensions: signal handling problem

Post by Holger Jou » Fri, 04 Jun 2004 21:48:05


Hi,
migrating from good old python 1.5.2 to python 2.3, I have a problem
running a program that features some threads which execute calls to
an extension module.
Problem is that all of a sudden, I cannot stop the program with a keyboard
interrupt any more; the installed signal handler does not seem to receive
the signal at all.
This happens both if I rebuild this extension using python 2.3
headers/library
and if I simply use the old extension (ignoring the API version warnings
:-)

Any hints?
Btw this is a sun sparc solaris 6 box, python 2.3.3.

G
Holger

Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene
Empfger sind oder falls diese E-Mail irrtlich an Sie adressiert wurde,
verstdigen Sie bitte den Absender sofort und lchen Sie die E-Mail
sodann. Das unerlaubte Kopieren sowie die unbefugte ermittlung sind nicht
gestattet. Die Sicherheit von ermittlungen per E-Mail kann nicht
garantiert werden. Falls Sie eine Bestigung wschen, fordern Sie bitte
den Inhalt der E-Mail als Hardcopy an.

The contents of this e-mail are confidential. If you are not the named
addressee or if this transmission has been addressed to you in error,
please notify the sender immediately and then delete this e-mail. Any
unauthorized copying and transmission is forbidden. E-Mail transmission
cannot be guaranteed to be secure. If verification is required, please
request a hard copy version.
 
 
 

Python 2.3.3 signals, threads & extensions: signal handling problem

Post by Andrew Mac » Mon, 07 Jun 2004 10:40:15


Don't mix signals and threads without a lot of careful doc reading and
planning. I strongly recommend re-reading the signal module docs.

One other thing to keep in mind is that in a multithreaded build, aside
from only the main thread receiving signals, is that the signal handler is
effectively queued until the next Python VM opcode is processed. A call
to a function in the extension is effectively a VM opcode, and if the
call doesn't return the handler will never execute.

 
 
 

Python 2.3.3 signals, threads & extensions: signal handling problem

Post by fishbo » Mon, 07 Jun 2004 15:19:26

On Thu, 3 Jun 2004 14:48:05 +0200, "Holger Joukl"



http://www.yqcomputer.com/ +signals&meta=group%3Dcomp.lang.python.*

Looking at this search leads me to believe:

1. Threads + signals = bad

2. at some point things were changed to send all signals to the main
thread. (python)

Which leads me to believe that your signal handler is in a sub-thread?

hth,
 
 
 

Python 2.3.3 signals, threads & extensions: signal handling problem

Post by Dieter Mau » Wed, 09 Jun 2004 06:05:45

"Holger Joukl" < XXXX@XXXXX.COM > writes on Thu, 3 Jun 2004 14:48:05 +0200:

python-Bugs-756924 may be related to your problem.

If so, you have a chance that the problem is fixed in Python 2.4.