Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-26443

Clean up error reporting in jstestfuzz_concurrent suite when mongo shell fails to spawn

    • Fully Compatible
    • TIG 2017-06-19

      The JSTestCase.ExceptionThread class captures any exceptions thrown by the JSTestCase._run_test_in_thread() method. However, it also re-raises the exception and causes it to be caught by the threading.Thread.__bootstrap_inner() method. This causes a backtrace to be printed to the stderr of the python process, despite whatever resmoke.py's logging configuration is.

      # A wrapper for the thread class that lets us propagate exceptions.
      class ExceptionThread(threading.Thread):
          def __init__(self, my_target, my_args):
              threading.Thread.__init__(self, target=my_target, args=my_args)
              self.err = None
      
          def run(self):
              try:
                  threading.Thread.run(self)
              except Exception as self.err:
                  raise
              else:
                  self.err = None
      
          def _get_exception(self):
              return self.err
      
      [2016/10/03 05:17:04.565] Exception in thread Thread-265:
      [2016/10/03 05:17:04.568] Traceback (most recent call last):
      [2016/10/03 05:17:04.568]   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
      [2016/10/03 05:17:04.568]     self.run()
      [2016/10/03 05:17:04.568]   File "/data/mci/c3b12f9f5f12ea37aa583944dde0ea77/src/buildscripts/resmokelib/testing/testcases.py", line 298, in run
      [2016/10/03 05:17:04.568]     threading.Thread.run(self)
      [2016/10/03 05:17:04.568]   File "/usr/lib/python2.7/threading.py", line 754, in run
      [2016/10/03 05:17:04.568]     self.__target(*self.__args, **self.__kwargs)
      [2016/10/03 05:17:04.568]   File "/data/mci/c3b12f9f5f12ea37aa583944dde0ea77/src/buildscripts/resmokelib/testing/testcases.py", line 422, in _run_test_in_thread
      [2016/10/03 05:17:04.568]     self._execute(shell)
      [2016/10/03 05:17:04.568]   File "/data/mci/c3b12f9f5f12ea37aa583944dde0ea77/src/buildscripts/resmokelib/testing/testcases.py", line 123, in _execute
      [2016/10/03 05:17:04.568]     raise self.failureException("%s failed" % (self.shortDescription()))
      [2016/10/03 05:17:04.568] AssertionError: JSTest jstestfuzz/out/0.0.178-445abe2e01-ent_2edc7f4222-qa_5959f1f3ac-1475471430998-06.js failed
      

      We should change it to not propagate the exception because it will be handled by the thread running the test when JSTestCase.ExceptionThread._get_exception() is called. Additionally, we should capture a reference to the exception as a local variable (and not into self.err) so that the syntax is compatible with Python 3.0+.

      except:
          self.err = sys.exc_info()[1]
      else:
          self.err = None
      

      https://evergreen.mongodb.com/task/mongodb_mongo_master_ubuntu1204_jstestfuzz_concurrent_WT_9a4474ea06409f729121283dadbdf3a17b131cdb_16_09_29_23_15_23
      https://evergreen.mongodb.com/task/mongodb_mongo_master_enterprise_ubuntu1604_64_jstestfuzz_concurrent_replication_WT_445abe2e01db50dad295ba8af4971eb243b02546_16_10_03_02_17_31

            Assignee:
            kimberly.hou Kimberly Hou
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: