65598582f5
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=179
48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
From 9ebf39f96704f17886e306ee270a06ef7126c381 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
|
|
<psuarezhernandez@suse.com>
|
|
Date: Tue, 30 Apr 2019 10:51:42 +0100
|
|
Subject: [PATCH] Use ThreadPool from multiprocessing.pool to avoid
|
|
leakings
|
|
|
|
---
|
|
salt/grains/core.py | 14 +++++++++-----
|
|
1 file changed, 9 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/salt/grains/core.py b/salt/grains/core.py
|
|
index 883e3ebe09..bebb4581bc 100644
|
|
--- a/salt/grains/core.py
|
|
+++ b/salt/grains/core.py
|
|
@@ -23,7 +23,7 @@ import uuid
|
|
import warnings
|
|
import zlib
|
|
from errno import EACCES, EPERM
|
|
-from multiprocessing.dummy import Pool as ThreadPool
|
|
+from multiprocessing.pool import ThreadPool
|
|
|
|
import distro
|
|
import salt.exceptions
|
|
@@ -2442,10 +2442,14 @@ def fqdns():
|
|
# Create a ThreadPool to process the underlying calls to 'socket.gethostbyaddr' in parallel.
|
|
# This avoid blocking the execution when the "fqdn" is not defined for certains IP addresses, which was causing
|
|
# that "socket.timeout" was reached multiple times secuencially, blocking execution for several seconds.
|
|
- pool = ThreadPool(8)
|
|
- results = pool.map(_lookup_fqdn, addresses)
|
|
- pool.close()
|
|
- pool.join()
|
|
+
|
|
+ try:
|
|
+ pool = ThreadPool(8)
|
|
+ results = pool.map(_lookup_fqdn, addresses)
|
|
+ pool.close()
|
|
+ pool.join()
|
|
+ except Exception as exc:
|
|
+ log.error("Exception while creating a ThreadPool for resolving FQDNs: %s", exc)
|
|
|
|
for item in results:
|
|
if item:
|
|
--
|
|
2.29.2
|
|
|
|
|