Re: Crash in signal handling in Jobs.py

Bill Deegan <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CAEyG4CGv9J1488-68__H8Y9BMh18iZrJAsBL=Ci=MF-qOQnS1w@mail.gmail.com>
Brian,

O.k. so if I understand correctly you have a signal handler registerer
outside SCons (in C code for example), and when this is the case python's
signal.signal() will return None?
And then when SCons tries to reset it back to it's original setting
attempts to set it to None and that causes Python to crash?

-Bill
SCons Co-Manager

On Wed, Oct 6, 2021 at 5:10 PM Brian Quistorff <[email protected]> wrote:

> Hello,
>
> Thanks all for the wonderful tool.
>
> My scons crashes in situations where there is a signal handler registered
> from "outside Python" (the phrase used in the Python docs for
> signal.signal). This happens for me when I run scons from inside Stata (a
> stats program), which embeds Python, and sets up a signal handler. I think
> this could also happen if one runs scons from a Python environment where a
> compiled plugin registered a signal handler. I tracked the problem to
> Jobs.py, where _setup_sig_handler() retrieves the previous signal handler
> (signal.signal() returns None in this case) and then in
> _reset_sig_handler() it tries to the set the signal handler to this
> previous (None) value. None is not allowed and this causes a crash.
>
> I've coded up a patch that resets the signal handler to signal.SIG_DFL
> (the default handler) when the previous one was None and warns the user
> that this is happening. I'm looking for feedback, to see if this is an
> acceptable fix, and if/how I should proceed on GitHub.
>
> Thanks,
> Brian
> _______________________________________________
> Scons-users mailing list
> [email protected]
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.