From 4f6978c7329c5dc8a29912f3ca9621471a7efbdc Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 5 Jul 2022 09:53:18 -0400 Subject: [PATCH] Island: Add TODO regarding gevent.lock() --- monkey/monkey_island/cc/resources/utils/semaphores.py | 2 ++ .../cc/services/reporting/report_generation_synchronisation.py | 2 ++ .../zero_trust/monkey_findings/monkey_zt_finding_service.py | 3 +++ 3 files changed, 7 insertions(+) diff --git a/monkey/monkey_island/cc/resources/utils/semaphores.py b/monkey/monkey_island/cc/resources/utils/semaphores.py index 4c9ef5ecc..006386487 100644 --- a/monkey/monkey_island/cc/resources/utils/semaphores.py +++ b/monkey/monkey_island/cc/resources/utils/semaphores.py @@ -1,3 +1,5 @@ +# TODO: Switch to threading.lock and test. Calling gevent.patch_all() is supposed to monkeypatch +# threading to be compatible with gevent/greenlets. from gevent.lock import BoundedSemaphore # Mutex avoids race condition between monkeys diff --git a/monkey/monkey_island/cc/services/reporting/report_generation_synchronisation.py b/monkey/monkey_island/cc/services/reporting/report_generation_synchronisation.py index 38f7ee9cb..66128bad2 100644 --- a/monkey/monkey_island/cc/services/reporting/report_generation_synchronisation.py +++ b/monkey/monkey_island/cc/services/reporting/report_generation_synchronisation.py @@ -1,5 +1,7 @@ import logging +# TODO: Switch to threading.lock and test. Calling gevent.patch_all() is supposed to monkeypatch +# threading to be compatible with gevent/greenlets. from gevent.lock import BoundedSemaphore logger = logging.getLogger(__name__) diff --git a/monkey/monkey_island/cc/services/zero_trust/monkey_findings/monkey_zt_finding_service.py b/monkey/monkey_island/cc/services/zero_trust/monkey_findings/monkey_zt_finding_service.py index 5428fe178..44ea485c8 100644 --- a/monkey/monkey_island/cc/services/zero_trust/monkey_findings/monkey_zt_finding_service.py +++ b/monkey/monkey_island/cc/services/zero_trust/monkey_findings/monkey_zt_finding_service.py @@ -1,6 +1,9 @@ from typing import List from bson import ObjectId + +# TODO: Switch to threading.lock and test. Calling gevent.patch_all() is supposed to monkeypatch +# threading to be compatible with gevent/greenlets. from gevent.lock import BoundedSemaphore from common.common_consts import zero_trust_consts