hundreds-breakfast-49010
09/10/2020, 9:56 PM./pants --no-pantsd fmt src/python/pants::hundreds-breakfast-49010
09/10/2020, 10:04 PM--no-pantsd case, a ctrl-c is still getting sent to one of the processes actively being run somehow. and the linters/formatters are handling this better than pytesthundreds-breakfast-49010
09/10/2020, 10:05 PM./pants --no-pantsd lint src/python/pants/engine:: and hit ctrl-c at the right time, I'll see a (say) black python traceback message in the consolewitty-crayon-22786
09/10/2020, 10:14 PMwitty-crayon-22786
09/10/2020, 10:14 PMhundreds-breakfast-49010
09/10/2020, 10:15 PMwitty-crayon-22786
09/10/2020, 10:15 PMwitty-crayon-22786
09/10/2020, 10:15 PMwitty-crayon-22786
09/10/2020, 10:16 PMhundreds-breakfast-49010
09/10/2020, 10:17 PMhundreds-breakfast-49010
09/10/2020, 10:17 PMwitty-crayon-22786
09/10/2020, 10:17 PMexecute loophundreds-breakfast-49010
09/10/2020, 10:17 PMhundreds-breakfast-49010
09/10/2020, 10:17 PMhundreds-breakfast-49010
09/10/2020, 10:17 PMhundreds-breakfast-49010
09/10/2020, 10:18 PM./pants --no-pantsd --no-dynamic-ui test src/python/pants/engine:: doesn't quit immediately on ctrl-c but does after a couple of trieswitty-crayon-22786
09/10/2020, 10:19 PMhundreds-breakfast-49010
09/10/2020, 10:19 PMwitty-crayon-22786
09/10/2020, 10:20 PMwitty-crayon-22786
09/10/2020, 10:20 PMhundreds-breakfast-49010
09/10/2020, 10:20 PMSignalHandler in exception_sink.py, which I'm actively messing with now to fix https://github.com/pantsbuild/pants/issues/10051witty-crayon-22786
09/10/2020, 10:20 PMhundreds-breakfast-49010
09/10/2020, 10:21 PMexcept KeyboardInterrupt block in pants_exe.pyhundreds-breakfast-49010
09/10/2020, 10:21 PMhundreds-breakfast-49010
09/10/2020, 10:23 PMKeyboardInterrupt exception. but we're already overriding thathundreds-breakfast-49010
09/10/2020, 10:23 PMKeyboardInterrupt ourselveswitty-crayon-22786
09/10/2020, 10:32 PMwitty-crayon-22786
09/10/2020, 10:33 PMwitty-crayon-22786
09/10/2020, 10:35 PMexecute loop observing the error.hundreds-breakfast-49010
09/10/2020, 10:43 PMKeyboardInterrupt, which that handler in pants_exe.py catcheshundreds-breakfast-49010
09/10/2020, 10:43 PMwitty-crayon-22786
09/10/2020, 10:45 PMwitty-crayon-22786
09/10/2020, 10:45 PMA long-running calculation implemented purely in C (such as regular expression matching on a large body of text) may run uninterrupted for an arbitrary amount of time, regardless of any signals received. The Python signal handlers will be called when the calculation finishes.witty-crayon-22786
09/10/2020, 10:45 PMwitty-crayon-22786
09/10/2020, 10:45 PMhundreds-breakfast-49010
09/10/2020, 10:47 PMKeyboardInterrupt, and eventually get rid of the python signal handlinghundreds-breakfast-49010
09/10/2020, 10:47 PMwitty-crayon-22786
09/10/2020, 10:48 PMwitty-crayon-22786
09/10/2020, 10:48 PMhundreds-breakfast-49010
09/10/2020, 10:48 PMwitty-crayon-22786
09/10/2020, 10:49 PMScheduler::executehundreds-breakfast-49010
09/10/2020, 10:50 PMScheduler:;execute respond to that flag, and eventually get rid of python SignalHandlerwitty-crayon-22786
09/10/2020, 10:50 PMwitty-crayon-22786
09/10/2020, 10:51 PMwitty-crayon-22786
09/10/2020, 10:51 PMwitty-crayon-22786
09/10/2020, 10:51 PMhundreds-breakfast-49010
09/10/2020, 10:52 PMhundreds-breakfast-49010
09/10/2020, 10:52 PMwitty-crayon-22786
09/10/2020, 10:52 PMwitty-crayon-22786
09/10/2020, 10:53 PMwitty-crayon-22786
09/10/2020, 10:53 PMwitty-crayon-22786
09/10/2020, 10:55 PMPython signal handlers are always executed in the main Python thread, even if the signal was received in another thread. This means that signals can't be used as a means of inter-thread communication. You can use the synchronization primitives from the threading module instead.witty-crayon-22786
09/10/2020, 10:56 PMwitty-crayon-22786
09/10/2020, 10:57 PMhundreds-breakfast-49010
09/10/2020, 10:57 PMhundreds-breakfast-49010
09/10/2020, 10:58 PMwitty-crayon-22786
09/10/2020, 10:58 PMScheduler::execute is the main thread.witty-crayon-22786
09/10/2020, 10:58 PMhundreds-breakfast-49010
09/10/2020, 10:59 PMScheduler::execute isn't the main thread, right? "Python signal handlers are always executed in the main Python thread, even if the signal was received in another thread."hundreds-breakfast-49010
09/10/2020, 11:00 PMSignalHandler, specifically https://github.com/pantsbuild/pants/blob/master/src/python/pants/base/exception_sink.py#L81witty-crayon-22786
09/10/2020, 11:00 PMScheduler::execute might not see the keyboard exeception.hundreds-breakfast-49010
09/10/2020, 11:00 PMPailgunClientSignalHandler in the pantsd case) just raises KeyboardInterruptwitty-crayon-22786
09/10/2020, 11:01 PMhundreds-breakfast-49010
09/10/2020, 11:01 PMwitty-crayon-22786
09/10/2020, 11:01 PMScheduler::execute and always have it die in practice, then that’s great. if you have to add a global condition variable, that’s still not bad.hundreds-breakfast-49010
09/11/2020, 12:26 AMwitty-crayon-22786
09/11/2020, 12:26 AMhundreds-breakfast-49010
09/11/2020, 12:27 AMwitty-crayon-22786
09/11/2020, 12:27 AM