sympy / sympy-bot-old

SymPy pull request helper
http://reviews.sympy.org/
Other
24 stars 16 forks source link

Some way for the bot to self-terminate instead of hang #155

Open asmeurer opened 11 years ago

asmeurer commented 11 years ago

If the tests of a PR hang, then the bot will also hang, which isn't very good for headless machines. There should be some failsafe. An easy thing to do would be to add a timeout. The default could be something large (say 4 hours per interpreter), but it could be configured. This can be implemented using alarms from the signals module.

Another way would be to exit if no activity happens for some given amount of time. This is what Travis does. If no output is given in 10 minutes, it assumes the tests are hanging and gives up. I think to implement this, one just needs to reset the alarm every time something is written.

Regardless, we also have to make sure that the alarm is disabled at the end with a finally block so that it doesn't trigger after the tests are done.

asmeurer commented 11 years ago

The last option is not as easy. I think one would need to hook sys.stdout with a custom function that resets the alarm, and you would need to be careful with subtleties like flushing and correctly reseting the alarm in finally.

vramana commented 11 years ago

@asmeurer I experienced this issue when I was reviewing a PR the tests test_plot.py and test_plot_implicit.py took excessively long time and my system hanged. Did it hang any time for you?

asmeurer commented 11 years ago

Yeah, sympy/sympy#1882.