aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2020-07-28 16:38:55 +0200
committerVratko Polak <vrpolak@cisco.com>2020-07-28 16:38:55 +0200
commit3f0822a35efc2fd61bcc4040bea13519f389b655 (patch)
tree8d27f2609d6a59d38ecf561359de0daddb3faee7
parent59b686ec3cdc4863d7a4ddc11c684bfb7df26a8e (diff)
Soak: Avoid a possible deadlock.
Change-Id: I31c2d7744b5cd3021132fb188480b8edec74986c Signed-off-by: Vratko Polak <vrpolak@cisco.com>
-rw-r--r--resources/libraries/python/PLRsearch/PLRsearch.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/resources/libraries/python/PLRsearch/PLRsearch.py b/resources/libraries/python/PLRsearch/PLRsearch.py
index fb4ee1a4d0..ec58fbd10f 100644
--- a/resources/libraries/python/PLRsearch/PLRsearch.py
+++ b/resources/libraries/python/PLRsearch/PLRsearch.py
@@ -601,15 +601,17 @@ class PLRsearch:
dilled_function = dill.dumps(value_logweight_func)
boss_pipe_end, worker_pipe_end = multiprocessing.Pipe()
- boss_pipe_end.send(
- (dimension, dilled_function, focus_tracker, max_samples)
- )
+ # Do not send yet, run the worker first to avoid a deadlock.
+ # See https://stackoverflow.com/a/15716500
worker = multiprocessing.Process(
target=Integrator.try_estimate_nd,
args=(worker_pipe_end, 10.0, self.trace_enabled)
)
worker.daemon = True
worker.start()
+ boss_pipe_end.send(
+ (dimension, dilled_function, focus_tracker, max_samples)
+ )
return boss_pipe_end
erf_pipe = start_computing(self.lfit_erf, erf_focus_tracker)