Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15437

[Python][FlightRPC] Flaky test test_interrupt

    XMLWordPrintableJSON

Details

    Description

      Found during 7.0.0 verification, it seems we aren't accounting for all possible ways to find the exception we expect

      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
       

      Attachments

        Issue Links

          Activity

            People

              lidavidm David Li
              lidavidm David Li
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 40m
                  2h 40m