# Buggy code
def shutdown(self):
    self.workflow_scheduling_manager.shutdown()
    self.job_manager.shutdown()
    self.object_store.shutdown()
    if self.heartbeat:
        self.heartbeat.shutdown()
    self.update_repository_manager.shutdown()
    try:
        self.control_worker.shutdown()
    except AttributeError:
        # There is no control_worker
        pass


# Traceback (IOError)
galaxy.tools.deps.installable WARNING 2017-10-03 12:25:28,961 Conda not installed and auto-installation disabled.
galaxy.tools.deps.installable WARNING 2017-10-03 12:25:29,016 Conda not installed and auto-installation disabled.
galaxy.datatypes.registry DEBUG 2017-10-03 12:25:29,034 Loaded external metadata tool: __SET_METADATA__
galaxy.tools.special_tools DEBUG 2017-10-03 12:25:29,048 Loaded history import tool: __IMPORT_HISTORY__
galaxy.tools.special_tools DEBUG 2017-10-03 12:25:29,057 Loaded history export tool: __EXPORT_HISTORY__
galaxy.queue_worker INFO 2017-10-03 12:25:29,060 Queuing async task rebuild_toolbox_search_index for main.
galaxy.queue_worker DEBUG 2017-10-03 12:25:29,074 Toolbox reload (324.466 ms)
ok
Check the count of repositories in the database named filtering_1470 and owned by user1. ... ok

----------------------------------------------------------------------
XML: /galaxy/xunit-7193.xml
----------------------------------------------------------------------
Ran 579 tests in 922.170s

OK
test_driver INFO 2017-10-03 12:25:30,298 Shutting down
test_driver INFO 2017-10-03 12:25:30,299 Shutting down embedded tool_shed web server
test_driver INFO 2017-10-03 12:25:30,302 Embedded web server tool_shed stopped
test_driver INFO 2017-10-03 12:25:30,303 Stopping application tool_shed
test_driver INFO 2017-10-03 12:25:30,303 Application tool_shed stopped.
test_driver INFO 2017-10-03 12:25:30,303 Shutting down embedded galaxy web server
test_driver INFO 2017-10-03 12:25:30,324 Embedded web server galaxy stopped
test_driver INFO 2017-10-03 12:25:30,328 Stopping application galaxy
galaxy.jobs.handler INFO 2017-10-03 12:25:30,328 sending stop signal to worker thread
galaxy.jobs.handler INFO 2017-10-03 12:25:30,328 job handler queue stopped
galaxy.jobs.runners INFO 2017-10-03 12:25:30,328 TaskRunner: Sending stop signal to 2 worker threads
galaxy.jobs.runners INFO 2017-10-03 12:25:30,328 LocalRunner: Sending stop signal to 5 worker threads
galaxy.jobs.handler INFO 2017-10-03 12:25:30,329 sending stop signal to worker thread
galaxy.jobs.handler INFO 2017-10-03 12:25:30,330 job handler stop queue stopped
test_driver INFO 2017-10-03 12:25:30,331 Application galaxy stopped.
tool_shed.galaxy_install.update_repository_manager INFO 2017-10-03 12:25:30,359 Update repository manager restarter shutting down...
galaxy.queue_worker DEBUG 2017-10-03 12:25:31,083 Executing toolbox reload on 'main'
galaxy.tools.toolbox.base INFO 2017-10-03 12:25:31,098 Parsing the tool configuration /galaxy/test/functional/tools/upload_tool_conf.xml
galaxy.tools.toolbox.base INFO 2017-10-03 12:25:31,099 Parsing the tool configuration /tmp/tmpDL4NYD/test_shed_tool_conf.xml
galaxy.tools.toolbox.base ERROR 2017-10-03 12:25:31,099 Error loading tools defined in config /tmp/tmpDL4NYD/test_shed_tool_conf.xml
Traceback (most recent call last):
File "/galaxy/lib/galaxy/tools/toolbox/base.py", line 114, in _init_tools_from_configs
self._init_tools_from_config(config_filename)
File "/galaxy/lib/galaxy/tools/toolbox/base.py", line 148, in _init_tools_from_config
tool_conf_source = get_toolbox_parser(config_filename)
File "/galaxy/lib/galaxy/tools/toolbox/parser.py", line 152, in get_toolbox_parser
return XmlToolConfSource(config_filename)
File "/galaxy/lib/galaxy/tools/toolbox/parser.py", line 40, in __init__
tree = parse_xml(config_filename)
File "/galaxy/lib/galaxy/util/__init__.py", line 217, in parse_xml
root = tree.parse(fname, parser=ElementTree.XMLParser(target=DoctypeSafeCallbackTarget()))
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 647, in parse
source = open(source, "rb")
IOError: [Errno 2] No such file or directory: '/tmp/tmpDL4NYD/test_shed_tool_conf.xml'
galaxy.tools.toolbox.base INFO 2017-10-03 12:25:31,100 Parsing the tool configuration /tmp/tmpDL4NYD/test_migrated_tool_conf.xml
galaxy.tools.toolbox.base ERROR 2017-10-03 12:25:31,101 Error loading tools defined in config /tmp/tmpDL4NYD/test_migrated_tool_conf.xml
Traceback (most recent call last):
File "/galaxy/lib/galaxy/tools/toolbox/base.py", line 114, in _init_tools_from_configs
self._init_tools_from_config(config_filename)
File "/galaxy/lib/galaxy/tools/toolbox/base.py", line 148, in _init_tools_from_config
tool_conf_source = get_toolbox_parser(config_filename)
File "/galaxy/lib/galaxy/tools/toolbox/parser.py", line 152, in get_toolbox_parser
return XmlToolConfSource(config_filename)
File "/galaxy/lib/galaxy/tools/toolbox/parser.py", line 40, in __init__
tree = parse_xml(config_filename)
File "/galaxy/lib/galaxy/util/__init__.py", line 217, in parse_xml
root = tree.parse(fname, parser=ElementTree.XMLParser(target=DoctypeSafeCallbackTarget()))
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 647, in parse
source = open(source, "rb")
IOError: [Errno 2] No such file or directory: '/tmp/tmpDL4NYD/test_migrated_tool_conf.xml'
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,101 Reading tools from config files finshed (2.666 ms)
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,101 Loading section: Get Data
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,101 Loading section: test_1000
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,101 Loading section: test_1010
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,101 Loading section: test_1020
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: test_1030
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: column_maker
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: emboss_5_0050
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: freebayes
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: test_1060
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: test_1070
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: convert_chars
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: new_column_maker
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,102 Loading section: new_convert_chars
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,103 Loading section: freebayes_1090
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,103 Loading section: filtering_1090
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,103 Loading section: bwa_1090
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,103 Loading section: Test 0120
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,103 Loading section: test_1410
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,103 Loading section: repair
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,103 Loading section: Filtering
galaxy.tools.toolbox.base DEBUG 2017-10-03 12:25:31,103 Loading tool panel finished (2.456 ms)
galaxy.tools.deps WARNING 2017-10-03 12:25:31,104 Path '/tmp/tmpDL4NYD/tmpfxt0uQ/database/tool_dependencies3eUpIz' does not exist, ignoring
galaxy.tools.deps WARNING 2017-10-03 12:25:31,105 Path '/tmp/tmpDL4NYD/tmpfxt0uQ/database/tool_dependencies3eUpIz' is not directory, ignoring
galaxy.tools.deps DEBUG 2017-10-03 12:25:31,105 Unable to find config file './dependency_resolvers_conf.xml'
Exception in thread ToolConfWatcher.thread:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/galaxy/lib/galaxy/tools/toolbox/watcher.py", line 123, in check
self.reload_callback()
File "/galaxy/lib/galaxy/webapps/galaxy/config_watchers.py", line 24, in <lambda>
self.tool_config_watcher = get_tool_conf_watcher(reload_callback=lambda: reload_toolbox(self.app), tool_cache=self.app.tool_cache)
File "/galaxy/lib/galaxy/queue_worker.py", line 92, in reload_toolbox
_get_new_toolbox(app)
File "/galaxy/lib/galaxy/queue_worker.py", line 111, in _get_new_toolbox
new_toolbox = tools.ToolBox(tool_configs, app.config.tool_path, app)
File "/galaxy/lib/galaxy/tools/__init__.py", line 226, in __init__
app=app,
File "/galaxy/lib/galaxy/tools/toolbox/base.py", line 1059, in __init__
self._init_dependency_manager()
File "/galaxy/lib/galaxy/tools/toolbox/base.py", line 1072, in _init_dependency_manager
self.dependency_manager = build_dependency_manager(self.app.config)
File "/galaxy/lib/galaxy/tools/deps/__init__.py", line 41, in build_dependency_manager
dependency_manager = DependencyManager(**dependency_manager_kwds)
File "/galaxy/lib/galaxy/tools/deps/__init__.py", line 85, in __init__
self.dependency_resolvers = self.__build_dependency_resolvers(conf_file)
File "/galaxy/lib/galaxy/tools/deps/__init__.py", line 194, in __build_dependency_resolvers
return self.__default_dependency_resolvers()
File "/galaxy/lib/galaxy/tools/deps/__init__.py", line 202, in __default_dependency_resolvers
CondaDependencyResolver(self),
File "/galaxy/lib/galaxy/tools/deps/resolvers/conda.py", line 138, in __init__
self.disabled = not galaxy.tools.deps.installable.ensure_installed(conda_context, install_conda, self.auto_init)
File "/galaxy/lib/galaxy/tools/deps/installable.py", line 68, in ensure_installed
os.mkdir(parent_path)
OSError: [Errno 2] No such file or directory: '/tmp/tmpDL4NYD/tmpfxt0uQ/database/tool_dependencies3eUpIz'

galaxy.jobs.handler INFO 2017-10-03 12:25:31,143 sending stop signal to worker thread
galaxy.jobs.handler INFO 2017-10-03 12:25:31,143 job handler queue stopped
galaxy.jobs.runners INFO 2017-10-03 12:25:31,144 TaskRunner: Sending stop signal to 2 worker threads
galaxy.jobs.runners INFO 2017-10-03 12:25:31,144 LocalRunner: Sending stop signal to 5 worker threads
galaxy.jobs.handler INFO 2017-10-03 12:25:31,144 sending stop signal to worker thread
galaxy.jobs.handler INFO 2017-10-03 12:25:31,145 job handler stop queue stopped
Restoring 1 unacknowledged message(s).
Exception in thread ToolConfWatcher.thread (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
File "/usr/lib/python2.7/threading.py", line 763, in run
File "/galaxy/lib/galaxy/tools/toolbox/watcher.py", line 101, in check
<type 'exceptions.TypeError'>: 'NoneType' object is not callable
Build timed out (after 75 minutes). Marking the build as aborted.
Build was aborted
Recording test results
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Adding one-line test results to commit status...
Setting status of 62bac4f0aa9f50a79761b9fff5942e478878b895 to FAILURE with url https://jenkins.galaxyproject.org/job/docker-toolshed/7193/ and message: 'Build finished. 579 tests run, 0 skipped, 0 failed.'
Using context: toolshed test
Finished: ABORTED

# Fixed code
def shutdown(self):
    self.watchers.shutdown()
    self.workflow_scheduling_manager.shutdown()
    self.job_manager.shutdown()
    self.object_store.shutdown()
    if self.heartbeat:
        self.heartbeat.shutdown()
    self.update_repository_manager.shutdown()
    try:
        self.control_worker.shutdown()
    except AttributeError:
        # There is no control_worker
        pass