Message6471

Author pekka.klarck
Recipients pekka.klarck
Date 2011-04-07.13:50:48
SpamBayes Score 3.8653075e-06
Marked as misclassified No
Message-id <1302184249.15.0.269331785746.issue1729@psf.upfronthosting.co.za>
In-reply-to
Content
I got a report from a team using a tool I develop that the tool fails to start with this error:

  IllegalArgumentException: Signal already used by VM: INT

This error occurs when the tool registers signal handlers with signal.signal. The code already catches ValueError which this method is documented to possibly raise [1] but obviously IllegalArgumentException goes through.

I looked at the source of signal module distributed with Jython 2.5.1 and noticed that it calls sun.misc.Signal.handle. I then looked at its documentation [2] which tells this in the beginning of the module doc:

"""Java code cannot register a handler for signals that are already used by the Java VM implementation. The Signal.handle function raises an IllegalArgumentException if such an attempt is made."""

It seems to me that calls to sun.misc.Signal.handle should be wrapped with try/except and possible IllegalArgumentException then reraised as a ValueError. I can provide a patch if this sounds like a good idea.

[1] http://docs.python.org/library/signal.html#signal.signal
[2] http://www.docjar.com/docs/api/sun/misc/Signal.html
History
Date User Action Args
2011-04-07 13:50:49pekka.klarcksetrecipients: + pekka.klarck
2011-04-07 13:50:49pekka.klarcksetmessageid: <1302184249.15.0.269331785746.issue1729@psf.upfronthosting.co.za>
2011-04-07 13:50:49pekka.klarcklinkissue1729 messages
2011-04-07 13:50:48pekka.klarckcreate