Skip to content

Fix test-run crash when default server is crashed #405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/admin_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ def cmd(self, socket, cmd, silent):
return res


class BrokenConsoleHandshake(RuntimeError):
pass


class AdminConnection(TarantoolConnection, ExecMixIn):
def execute_no_reconnect(self, command, silent):
if not command:
Expand All @@ -93,7 +97,7 @@ def connect(self):
super(AdminConnection, self).connect()
handshake = get_handshake(self.socket)
if not re.search(r'^Tarantool.*console.*', str(handshake)):
raise RuntimeError('Broken tarantool console handshake')
raise BrokenConsoleHandshake('Broken tarantool console handshake')


class AdminAsyncConnection(TarantoolAsyncConnection, ExecMixIn):
Expand Down
13 changes: 9 additions & 4 deletions lib/tarantool_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Python 3
from io import StringIO

from lib.admin_connection import AdminConnection, AdminAsyncConnection
from lib.admin_connection import AdminConnection, AdminAsyncConnection, BrokenConsoleHandshake
from lib.box_connection import BoxConnection
from lib.colorer import color_stdout
from lib.colorer import color_log
Expand Down Expand Up @@ -421,14 +421,17 @@ def execute(self, server):


class TarantoolStartError(OSError):
def __init__(self, name=None, timeout=None):
def __init__(self, name=None, timeout=None, reason=None):
self.name = name
self.timeout = timeout
self.reason = reason

def __str__(self):
message = '[Instance "{}"] Failed to start'.format(self.name)
if self.timeout:
return "\n{} within {} seconds\n".format(message, self.timeout)
message = "{} within {} seconds".format(message, self.timeout)
if self.reason:
message = "{}: {}".format(message, self.reason)
return "\n{}\n".format(message)


Expand Down Expand Up @@ -957,7 +960,7 @@ def crash_detect(self):
if self.process.returncode is None:
gevent.sleep(0.1)

if self.process.returncode in [0, -signal.SIGKILL, -signal.SIGTERM]:
if self.process.returncode in [0, -signal.SIGABRT, -signal.SIGKILL, -signal.SIGTERM]:
return

self.kill_current_test()
Expand Down Expand Up @@ -1168,6 +1171,8 @@ def wait_until_started(self, wait_load=True, deadline=None):
gevent.sleep(0.1)
continue
raise
except BrokenConsoleHandshake as e:
raise TarantoolStartError(self.name, reason=e)
else:
raise TarantoolStartError(
self.name, Options().args.server_start_timeout)
Expand Down
4 changes: 4 additions & 0 deletions lib/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from lib.colorer import color_log
from lib.colorer import color_stdout
from lib.tarantool_server import TarantoolServer
from lib.tarantool_server import TarantoolStartError
from lib.test import get_result
from lib.test_suite import TestSuite
from lib.utils import safe_makedirs
Expand Down Expand Up @@ -285,6 +286,9 @@ def __init__(self, suite, _id):
except KeyboardInterrupt:
self.report_keyboard_interrupt()
self.stop_server(cleanup=False)
except TarantoolStartError as e:
color_stdout(e, schema='error')
self.stop_server(cleanup=False)
except Exception as e:
color_stdout('Worker "%s" cannot start tarantool server; '
'the tasks will be ignored...\n' % self.name,
Expand Down
4 changes: 1 addition & 3 deletions listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def process_result(self, obj):
self.stats[obj.short_status] += 1

if obj.short_status == 'fail':
self.failed_tasks.append((obj.task_id,
obj.worker_name,
obj.show_reproduce_content))
self.failed_tasks.append((obj.task_id, obj.worker_name, False))

self.duration_stats[obj.task_id] = obj.duration
self.print_status_line()
Expand Down