Lucene - Core
  1. Lucene - Core
  2. LUCENE-2338

Some tests catch Exceptions in separate threads and just print a stack trace - the test does not fail

    Details

    • Type: Test Test
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 4.9, 5.0
    • Component/s: general/build
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Some tests catch Exceptions in separate threads and just print a stack trace - the test does not fail. The test should fail. Since LUCENE-2274, the LuceneTestCase(J4) class installs an UncaughtExceptionHandler, so this type of catching and solely printing a Stack trace is a bad idea. Problem is, that the run() method of threads is not allowed to throw checked Exceptions.

      Two possibilities:

      • Catch checked Exceptions in the run() method and wrap into RuntimeException or call Assert.fail() instead
      • Use Executors

        Issue Links

          Activity

          Uwe Schindler made changes -
          Fix Version/s 4.9 [ 12326730 ]
          Fix Version/s 5.0 [ 12321663 ]
          Fix Version/s 4.8 [ 12326269 ]
          Hide
          Uwe Schindler added a comment -

          Move issue to Lucene 4.9.

          Show
          Uwe Schindler added a comment - Move issue to Lucene 4.9.
          David Smiley made changes -
          Fix Version/s 4.8 [ 12326269 ]
          Fix Version/s 4.7 [ 12325572 ]
          Simon Willnauer made changes -
          Fix Version/s 4.7 [ 12325572 ]
          Fix Version/s 4.6 [ 12324999 ]
          Adrien Grand made changes -
          Fix Version/s 4.6 [ 12324999 ]
          Fix Version/s 5.0 [ 12321663 ]
          Fix Version/s 4.5 [ 12324742 ]
          Steve Rowe made changes -
          Fix Version/s 5.0 [ 12321663 ]
          Fix Version/s 4.5 [ 12324742 ]
          Fix Version/s 4.4 [ 12324323 ]
          Hide
          Steve Rowe added a comment -

          Bulk move 4.4 issues to 4.5 and 5.0

          Show
          Steve Rowe added a comment - Bulk move 4.4 issues to 4.5 and 5.0
          Uwe Schindler made changes -
          Fix Version/s 4.4 [ 12324323 ]
          Fix Version/s 4.3 [ 12324143 ]
          Robert Muir made changes -
          Fix Version/s 4.3 [ 12324143 ]
          Fix Version/s 4.2 [ 12323899 ]
          Steve Rowe made changes -
          Fix Version/s 4.2 [ 12323899 ]
          Fix Version/s 4.1 [ 12321140 ]
          Robert Muir made changes -
          Fix Version/s 4.1 [ 12321140 ]
          Fix Version/s 4.0 [ 12322550 ]
          Robert Muir made changes -
          Fix Version/s 4.0 [ 12322550 ]
          Fix Version/s 4.0-BETA [ 12322456 ]
          Hide
          Robert Muir added a comment -

          rmuir20120906-bulk-40-change

          Show
          Robert Muir added a comment - rmuir20120906-bulk-40-change
          Hoss Man made changes -
          Fix Version/s 4.0 [ 12322456 ]
          Fix Version/s 4.0-ALPHA [ 12314025 ]
          Hide
          Hoss Man added a comment -

          bulk cleanup of 4.0-ALPHA / 4.0 Jira versioning. all bulk edited issues have hoss20120711-bulk-40-change in a comment

          Show
          Hoss Man added a comment - bulk cleanup of 4.0-ALPHA / 4.0 Jira versioning. all bulk edited issues have hoss20120711-bulk-40-change in a comment
          Uwe Schindler made changes -
          Fix Version/s 3.6 [ 12319070 ]
          Hide
          Uwe Schindler added a comment -

          I remove 3.x branch. I chacked all tests using e.printStackTrace() and all have some (outdated) logic to report the failure. In trunk we should rewrite those tests to simply fail()/rethrow as RuntimeEx on any Exception in threads. This way the failures are reported consistently.

          Show
          Uwe Schindler added a comment - I remove 3.x branch. I chacked all tests using e.printStackTrace() and all have some (outdated) logic to report the failure. In trunk we should rewrite those tests to simply fail()/rethrow as RuntimeEx on any Exception in threads. This way the failures are reported consistently.
          Hoss Man made changes -
          Assignee Uwe Schindler [ thetaphi ]
          Hide
          Hoss Man added a comment -

          Issue is marked 3.6 and actively being discussed but has no assignee - assigning to most active committer contributing patches/discussion so far to triage wether this can/should be pushed to 4.0 or not.

          Show
          Hoss Man added a comment - Issue is marked 3.6 and actively being discussed but has no assignee - assigning to most active committer contributing patches/discussion so far to triage wether this can/should be pushed to 4.0 or not.
          Michael McCandless made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Michael McCandless added a comment -

          Were all tests already converted to not supress exceptions in threads? This is why the issue is still open...

          Oh, woops: I don't know!

          Reopening...

          Show
          Michael McCandless added a comment - Were all tests already converted to not supress exceptions in threads? This is why the issue is still open... Oh, woops: I don't know! Reopening...
          Hide
          Uwe Schindler added a comment -

          Were all tests already converted to not supress exceptions in threads? This is why the issue is still open...

          Show
          Uwe Schindler added a comment - Were all tests already converted to not supress exceptions in threads? This is why the issue is still open...
          Michael McCandless made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 3.6 [ 12319070 ]
          Fix Version/s 4.0 [ 12314025 ]
          Resolution Fixed [ 1 ]
          Hide
          Michael McCandless added a comment -

          Our test framework fails tests w/ errant exceptions from threads now...

          Show
          Michael McCandless added a comment - Our test framework fails tests w/ errant exceptions from threads now...
          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12563514 ] jira [ 12585106 ]
          Mark Thomas made changes -
          Workflow jira [ 12502501 ] Default workflow, editable Closed status [ 12563514 ]
          Robert Muir made changes -
          Component/s Build [ 12311546 ]
          Hide
          Uwe Schindler added a comment -

          Hi Sanjoy,

          just grep on "printStackTrace(" to find test cases that simply print out stacktraces and ignore exceptions. Possible examples can be seen also in related issues like LUCENE-1814.

          Thanks for your interest in fixing this!

          Show
          Uwe Schindler added a comment - Hi Sanjoy, just grep on "printStackTrace(" to find test cases that simply print out stacktraces and ignore exceptions. Possible examples can be seen also in related issues like LUCENE-1814 . Thanks for your interest in fixing this!
          Hide
          Sanjoy Ghosh added a comment -

          Hi Uwe,

          I can work on this bug. Do you have any test cases to reproduce this behavior?

          Sanjoy

          Show
          Sanjoy Ghosh added a comment - Hi Uwe, I can work on this bug. Do you have any test cases to reproduce this behavior? Sanjoy
          Uwe Schindler made changes -
          Field Original Value New Value
          Link This issue requires LUCENE-2274 [ LUCENE-2274 ]
          Uwe Schindler created issue -

            People

            • Assignee:
              Uwe Schindler
              Reporter:
              Uwe Schindler
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Development