Thrift
  1. Thrift
  2. THRIFT-487

ThreadManagerTests::blockTest errors

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.1
    • Fix Version/s: None
    • Component/s: Test Suite
    • Labels:
      None
    • Environment:

      Mac OS X 10.5.6, Xcode

    • Patch Info:
      Patch Available

      Description

      The ThreadManagerTests::blockTest() method and its associated ThreadManagerTests::BlockTask class have errors and race conditions that cause frequent failures in the test. Some failure modes return to the caller, but others just hang the test forever. The main problem is that the test function relies on indirect indications that its tasks have reached certain known conditions. The indications that it sees are actually caused by the ThreadManager's Workers, and this results in a number of race conditions between the test function and the BlockTasks.

      There are 2 patch files attached. One patches the ThreadManagerTests.h file to fix the test. The other patches Tests.cpp so that it will run the blockTest in a loop. In my experience, an unpatched version of ThreadManagerTests.h generally fails within 100 iterations. After being patched, the test will still fail unless a separate patch is applied to the ThreadManager.cpp file. That patch is part of another issue that I haven't entered yet (because it needs to refer to this one). When I know its number I will add a comment. Anyway, if the patch is applied to ThreadManagerTests.h, but not to ThreadManager.cpp, then the test will still fail, generally with an assert, but sometimes with a Bus Error.

      Test Procedure:
      1) Apply the Tests.cpp patch. This makes the thread-manager portion of the test run ONLY the blockTest in an effectively infinite loop.
      2) Run a make in lib/cpp in order to rebuild concurrency-test
      3) Run concurrency test with the command line argument "thread-manager". This will start the blockTest loop. It should fail in a fairly short time. Repeated runs may fail different ways, including infinite hangs.
      4) Apply the patch to ThreadManagerTests.h.
      5) Run make in lib/cpp to rebuild concurrency-test
      6) Run concurrency_test as before. It should probably run for a longer period of time. I have seen it run for an hour or more after beng patched. Eventually it should fail either with an assert in Monitor.cpp while trying to destroy a pthread_mutex_t, or it will get a Bus Error because it tried to execute invalid memory. I have also seen it hang forever.

      In order to resolve the remaining issues, a patch needs to be applied to ThreadManager.cpp. I will add a comment about that as soon as the issue is filed and the patch is available.

      1. ThreadManagerTests.h.patch
        7 kB
        Rush Manbert
      2. Tests.cpp.patch
        0.9 kB
        Rush Manbert

        Issue Links

          Activity

          Rush Manbert created issue -
          Rush Manbert made changes -
          Field Original Value New Value
          Attachment Tests.cpp.patch [ 12407293 ]
          Attachment ThreadManagerTests.h.patch [ 12407294 ]
          Rush Manbert made changes -
          Link This issue relates to THRIFT-488 [ THRIFT-488 ]
          Rush Manbert made changes -
          Link This issue blocks THRIFT-488 [ THRIFT-488 ]
          Gavin made changes -
          Link This issue blocks THRIFT-488 [ THRIFT-488 ]
          Gavin made changes -
          Link This issue is depended upon by THRIFT-488 [ THRIFT-488 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Rush Manbert
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Development