Skip to content

Commit

Permalink
Move to GreenThreadPoolExecutor
Browse files Browse the repository at this point in the history
python3.7 and eventlet cause the `future.ThreadPoolExecutor` to hang
indefinitely. Moving to `futurist.GreenThreadPoolExecutor` allows the
`designate-worker` process to use native eventlet greenthreads, which bypasses
the hanging issue.

Closes-Bug: #1782647

Related-Bug: https://bugs.python.org/issue34173
Related-Bug: eventlet/eventlet#508

Change-Id: I36c79ca72635d81cfcc8d3cc87b1bc5e0657d9e8
Signed-off-by: Graham Hayes <gr@ham.ie>
  • Loading branch information
grahamhayes committed Oct 19, 2018
1 parent 8c17476 commit 72e4e13
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
7 changes: 5 additions & 2 deletions designate/worker/processing.py
Expand Up @@ -15,7 +15,7 @@
# under the License.
import time

from concurrent import futures
import futurist
from oslo_log import log as logging
from oslo_config import cfg

Expand All @@ -32,7 +32,10 @@ def default_executor():
except Exception:
pass

return futures.ThreadPoolExecutor(thread_count)
# TODO(mugsie): if (when) we move away from eventlet this may have to
# revert back to ThreadPoolExecutor - this is changing due to
# https://bugs.launchpad.net/bugs/1782647 (eventlet + py37 issues)
return futurist.GreenThreadPoolExecutor(thread_count)


class Executor(object):
Expand Down
2 changes: 1 addition & 1 deletion lower-constraints.txt
Expand Up @@ -36,7 +36,7 @@ flake8==2.5.5
Flask==0.10
funcparserlib==0.3.6
future==0.16.0
futurist==1.6.0
futurist==1.2.0
gitdb2==2.0.3
GitPython==2.1.8
greenlet==0.4.10
Expand Down
8 changes: 8 additions & 0 deletions releasenotes/notes/worker-executor-84d983c92dd13b49.yaml
@@ -0,0 +1,8 @@
---
other:
- |
To allow for python3.7 support, the `designate-worker` service was changed
from a `ThreadPoolExecutor` to a `GreenThreadPoolExecutor`. This should
no impact for most deployments, but in some cases it may cause performance
degredation. In these cases, tuning `[service:worker].workers` and
`[service:worker].threads` alleviate the issues.
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -48,3 +48,4 @@ tooz>=1.58.0 # Apache-2.0
debtcollector>=1.2.0 # Apache-2.0
os-win>=3.0.0 # Apache-2.0
monasca-statsd>=1.1.0 # Apache-2.0
futurist>=1.2.0 # Apache-2.0

0 comments on commit 72e4e13

Please sign in to comment.