[SERVER-26443] Clean up error reporting in jstestfuzz_concurrent suite when mongo shell fails to spawn Created: 03/Oct/16  Updated: 06/Dec/17  Resolved: 08/Jun/17

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.5.9

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Kimberly Hou
Resolution: Done Votes: 0
Labels: neweng, tig-resmoke
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-29522 exit code reported by resmoke.py for ... Closed
Backwards Compatibility: Fully Compatible
Sprint: TIG 2017-06-19
Participants:

 Description   

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



 Comments   
Comment by Githook User [ 08/Jun/17 ]

Author:

{u'name': u'Kimberly Hou', u'email': u'kimberly.hou@mongodb.com'}

Message: SERVER-26443 clean up error reporting in jstestfuzz_concurrent suite
Branch: master
https://github.com/mongodb/mongo/commit/23f38f73d21b2dce00f1bc2239c941ea43c59b03

Comment by Max Hirschhorn [ 03/Oct/16 ]

While addressing this issue, we should also consider making the exit code reported by resmoke.py for the test case more meaningful. It is currently set to the return code of the process that finishes last.

Generated at Thu Feb 08 04:12:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.