Re: Crash in signal handling in Jobs.py
Bill Deegan <[email protected]>
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <CAEyG4CHVQo0gy3Wk89sMsc8YZCevBWFykTRdmvRqefC9GGTT1w@mail.gmail.com> |
Please PR your solution. Here's a wiki page with some hints on how to.. https://github.com/SCons/scons/wiki/GitWorkflows Please consider joining our discord server, may be a bit easier to help you through any bumps in the road to get a first PR through.. https://discord.gg/pejaFYrD9n On Thu, Oct 7, 2021 at 3:38 AM Brian Quistorff <[email protected]> wrote: > Hi Bill, > > Yes, that's the situation. > > Thanks, Brian > > > > On Wed, Oct 6, 2021 at 9:31 PM Bill Deegan <[email protected]> > wrote: > >> I see this >> "None means that the previous signal handler was not installed from >> Python." >> >> In the docs >> https://docs.python.org/3/library/signal.html#signal.getsignal >> -Bill >> >> On Wed, Oct 6, 2021 at 6:29 PM Bill Deegan <[email protected]> >> wrote: >> >>> 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 >> > _______________________________________________ > 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