Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-3409

Unexpected behavior of DoFn teardown method running in unit tests

Details

    • Bug
    • Status: Resolved
    • P0
    • Resolution: Fixed
    • 2.3.0
    • 2.5.0
    • runner-direct

    Description

      Writing a unit test, I found out a strange behaviour of Teardown method of DoFn implementation when I run this method in unit tests using TestPipeline.

      To be more precise, it doesn’t wait until teardown() method will be finished, it just exits from this method after about 1 sec (on my machine) even if it should take longer (very simple example - running infinite loop inside this method or put thread in sleep). In the same time, when I run the same code from main() with ordinary Pipeline and direct runner, then it’s ok and it works as expected - teardown() method will be performed completely despite how much time it will take.

      I created two test cases to reproduce this issue - the first one to run with main() and the second one to run with junit. They use the same implementation of DoFn (class LongTearDownFn) and expects that teardown method will be running at least for SLEEP_TIME ms. In case of running as junit test it's not a case (see output log).

      Attachments

        Issue Links

          Activity

            People

              romain.manni-bucau Romain Manni-Bucau
              aromanenko Alexey Romanenko
              Votes:
              0 Vote for this issue
              Watchers:
              5 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 - 7h 10m
                  7h 10m