David Li created ARROW-15437: -------------------------------- Summary: [Python][FlightRPC] Flaky test test_interrupt Key: ARROW-15437 URL: https://issues.apache.org/jira/browse/ARROW-15437 Project: Apache Arrow Issue Type: Bug Components: FlightRPC, Python Reporter: David Li
Found during 7.0.0 verification, it seems we aren't accounting for all possible ways to find the exception we expect {noformat} pyarrow/tests/test_flight.py::test_interrupt FAILED [ 93%] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> def >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> test_interrupt(): if threading.current_thread().ident != threading.main_thread().ident: pytest.skip("test only works from main Python thread") # Skips test if not available raise_signal = util.get_raise_signal() def signal_from_thread(): time.sleep(0.5) raise_signal(signal.SIGINT) exc_types = (KeyboardInterrupt, pa.ArrowCancelled) def test(read_all): try: try: t = threading.Thread(target=signal_from_thread) with pytest.raises(exc_types) as exc_info: t.start() read_all() finally: t.join() except KeyboardInterrupt: # In case KeyboardInterrupt didn't interrupt read_all # above, at least prevent it from stopping the test suite pytest.fail("KeyboardInterrupt didn't interrupt Flight read_all") e = exc_info.value.__context__ assert isinstance(e, pa.ArrowCancelled) or \ isinstance(e, KeyboardInterrupt) with CancelFlightServer() as server: client = FlightClient(("localhost", server.port)) reader = client.do_get(flight.Ticket(b"")) > test(reader.read_all)pyarrow/tests/test_flight.py:1952: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ read_all = <built-in method read_all of pyarrow._flight.FlightStreamReader object at 0x7f40a80c6f40> def test(read_all): try: try: t = threading.Thread(target=signal_from_thread) with pytest.raises(exc_types) as exc_info: t.start() read_all() finally: t.join() except KeyboardInterrupt: # In case KeyboardInterrupt didn't interrupt read_all # above, at least prevent it from stopping the test suite pytest.fail("KeyboardInterrupt didn't interrupt Flight read_all") e = exc_info.value.__context__ > assert isinstance(e, pa.ArrowCancelled) or \ isinstance(e, KeyboardInterrupt) E AssertionError: assert (False or False) E + where False = isinstance(None, <class 'pyarrow.lib.ArrowCancelled'>) E + where <class 'pyarrow.lib.ArrowCancelled'> = pa.ArrowCancelled E + and False = isinstance(None, KeyboardInterrupt)pyarrow/tests/test_flight.py:1945: AssertionError >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> (IO-capturing turned >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > /tmp/arrow/apache-arrow-7.0.0/python/pyarrow/tests/test_flight.py(1945)test() -> assert isinstance(e, pa.ArrowCancelled) or \ (Pdb) p e None (Pdb) p exc_info <ExceptionInfo ArrowCancelled('Operation cancelled. Detail: received signal 2') tblen=5> (Pdb) p exc_info.value ArrowCancelled('Operation cancelled. Detail: received signal 2') (Pdb) p exc_info.value.__context__ None {noformat} -- This message was sent by Atlassian Jira (v8.20.1#820001)