1 From 9b07423c246e7e4ab9fa25851d79ce6986c10c2e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?C=C3=A9dric=20Ollivier?= <cedric.ollivier@orange.com>
3 Date: Wed, 3 Jun 2020 15:23:59 +0200
4 Subject: [PATCH] Switch to threading.Thread() for Rally tasks
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 multiprocessing.Process() often fails due to thread crashes [1].
10 It looks similar to gsutil release notes [2].
12 [1] https://build.opnfv.org/ci/job/functest-opnfv-functest-benchmarking-cntt-latest-rally_full_cntt-run/35/console
13 [2] https://github.com/GoogleCloudPlatform/gsutil/issues/548
14 [3] https://github.com/GoogleCloudPlatform/gsutil/blob/master/CHANGES.md
16 Change-Id: I582933832e23d188c7fa5999e713dd5d7e82d2da
17 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
19 rally/cli/main.py | 5 ++++-
20 rally/task/runner.py | 7 ++++---
21 2 files changed, 8 insertions(+), 4 deletions(-)
23 diff --git a/rally/cli/main.py b/rally/cli/main.py
24 index 235a57113..14c057c0e 100644
25 --- a/rally/cli/main.py
26 +++ b/rally/cli/main.py
29 """CLI interface for Rally."""
31 +STACK_SIZE = 1024 * 1024
33 +threading.stack_size(STACK_SIZE)
37 from rally.cli import cliutils
38 @@ -25,7 +29,6 @@ from rally.cli.commands import plugin
39 from rally.cli.commands import task
40 from rally.cli.commands import verify
45 "env": env.EnvCommands,
46 diff --git a/rally/task/runner.py b/rally/task/runner.py
47 index 3397e1193..5edebb406 100644
48 --- a/rally/task/runner.py
49 +++ b/rally/task/runner.py
50 @@ -17,6 +17,7 @@ import abc
53 import multiprocessing
57 from rally.common import logging
58 @@ -186,9 +187,9 @@ class ScenarioRunner(plugin.Plugin, validation.ValidatablePluginMixin,
59 for i in range(processes_to_start):
60 kwrgs = {"processes_to_start": processes_to_start,
61 "processes_counter": i}
62 - process = multiprocessing.Process(target=worker_process,
63 - args=next(worker_args_gen),
64 - kwargs={"info": kwrgs})
65 + process = threading.Thread(target=worker_process,
66 + args=next(worker_args_gen),
67 + kwargs={"info": kwrgs})
69 process_pool.append(process)