Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Fixed
Contributed by Nick Maludy (@nmaludy Encore Technologies)


* Fixed a bug where a python3 sensor using ssl needs to be monkey patched earlier. #4975 ( See also
#4832 and https://github.com/gevent/gevent/issues/1016) Contributed by @punkrokk

3.2.0 - April 27, 2020
----------------------

Expand Down
1 change: 1 addition & 0 deletions st2actions/st2actions/cmd/actionrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# Monkey patching should be done as early as possible.
# See http://eventlet.net/doc/patching.html#monkeypatching-the-standard-library
from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

Expand Down
7 changes: 4 additions & 3 deletions st2actions/st2actions/cmd/st2notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@
# limitations under the License.

from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import sys

from st2common import log as logging
from st2common.service_setup import setup as common_setup
from st2common.service_setup import teardown as common_teardown
from st2common.util.monkey_patch import monkey_patch
from st2actions.notifier import config
from st2actions.notifier import notifier

__all__ = [
'main'
]

monkey_patch()

LOG = logging.getLogger(__name__)


Expand Down
7 changes: 4 additions & 3 deletions st2actions/st2actions/cmd/st2resultstracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
# limitations under the License.

from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import sys

from st2common import log as logging
from st2common.service_setup import setup as common_setup
from st2common.service_setup import teardown as common_teardown
from st2common.util.monkey_patch import monkey_patch
from st2actions.resultstracker import config
from st2actions.resultstracker import resultstracker

Expand All @@ -28,8 +31,6 @@
]


monkey_patch()

LOG = logging.getLogger(__name__)


Expand Down
5 changes: 3 additions & 2 deletions st2auth/st2auth/cmd/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import eventlet
import os
import sys
Expand All @@ -22,7 +25,6 @@
from st2common import log as logging
from st2common.service_setup import setup as common_setup
from st2common.service_setup import teardown as common_teardown
from st2common.util.monkey_patch import monkey_patch
from st2auth import config
config.register_opts()

Expand All @@ -34,7 +36,6 @@
'main'
]

monkey_patch()

LOG = logging.getLogger(__name__)

Expand Down
7 changes: 4 additions & 3 deletions st2common/bin/paramiko_ssh_evenlets_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@


from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import argparse
import os
import pprint

from st2common.util.monkey_patch import monkey_patch
from st2common.ssh.parallel_ssh import ParallelSSHClient

monkey_patch()


def main(user, pkey, password, hosts_str, cmd, file_path, dir_path, delete_dir):
hosts = hosts_str.split(",")
Expand Down
5 changes: 3 additions & 2 deletions st2exporter/st2exporter/cmd/st2exporter_starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import sys

Expand All @@ -20,13 +23,11 @@
from st2common.service_setup import teardown as common_teardown
from st2exporter import config
from st2exporter import worker
from st2common.util.monkey_patch import monkey_patch

__all__ = [
'main'
]

monkey_patch()

LOG = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions st2reactor/st2reactor/cmd/garbagecollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import sys

Expand All @@ -23,7 +26,6 @@
from st2common.logging.misc import get_logger_name_for_module
from st2common.service_setup import setup as common_setup
from st2common.service_setup import teardown as common_teardown
from st2common.util.monkey_patch import monkey_patch
from st2common.constants.exit_codes import FAILURE_EXIT_CODE
from st2reactor.garbage_collector import config
from st2reactor.garbage_collector.base import GarbageCollectorService
Expand All @@ -32,8 +34,6 @@
'main'
]

monkey_patch()


LOGGER_NAME = get_logger_name_for_module(sys.modules[__name__])
LOG = logging.getLogger(LOGGER_NAME)
Expand Down
7 changes: 4 additions & 3 deletions st2reactor/st2reactor/cmd/rulesengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
# limitations under the License.

from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import sys

from st2common import log as logging
from st2common.logging.misc import get_logger_name_for_module
from st2common.service_setup import setup as common_setup
from st2common.service_setup import teardown as common_teardown
from st2common.util.monkey_patch import monkey_patch
from st2reactor.rules import config
from st2reactor.rules import worker

monkey_patch()


LOGGER_NAME = get_logger_name_for_module(sys.modules[__name__])
LOG = logging.getLogger(LOGGER_NAME)
Expand Down
5 changes: 3 additions & 2 deletions st2reactor/st2reactor/cmd/sensormanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import sys

Expand All @@ -23,7 +26,6 @@
from st2common.logging.misc import get_logger_name_for_module
from st2common.service_setup import setup as common_setup
from st2common.service_setup import teardown as common_teardown
from st2common.util.monkey_patch import monkey_patch
from st2common.exceptions.sensors import SensorNotFoundException
from st2common.constants.exit_codes import FAILURE_EXIT_CODE
from st2reactor.sensor import config
Expand All @@ -34,7 +36,6 @@
'main'
]

monkey_patch()

LOGGER_NAME = get_logger_name_for_module(sys.modules[__name__])
LOG = logging.getLogger(LOGGER_NAME)
Expand Down
5 changes: 3 additions & 2 deletions st2reactor/st2reactor/cmd/timersengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import sys

Expand All @@ -25,11 +28,9 @@
from st2common.logging.misc import get_logger_name_for_module
from st2common.service_setup import setup as common_setup
from st2common.service_setup import teardown as common_teardown
from st2common.util.monkey_patch import monkey_patch
from st2reactor.timer import config
from st2reactor.timer.base import St2Timer

monkey_patch()

LOGGER_NAME = get_logger_name_for_module(sys.modules[__name__])
LOG = logging.getLogger(LOGGER_NAME)
Expand Down
14 changes: 12 additions & 2 deletions st2reactor/st2reactor/container/sensor_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@

from __future__ import absolute_import

# Note: We need to perform monkey patching in the worker. If we do it in
# the master process (gunicorn_config.py), it breaks tons of things
# including shutdown
# NOTE: It's important that we perform monkey patch as early as possible before any other modules
# are imported, otherwise SSL support for sensor clients won't work.
# See https://github.com/StackStorm/st2/issues/4832, https://github.com/StackStorm/st2/issues/4975
# and https://github.com/gevent/gevent/issues/1016
# for details.

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import json
import atexit
Expand All @@ -36,15 +48,13 @@
from st2reactor.sensor.base import PollingSensor
from st2reactor.sensor import config
from st2common.services.datastore import SensorDatastoreService
from st2common.util.monkey_patch import monkey_patch
from st2common.util.monkey_patch import use_select_poll_workaround

__all__ = [
'SensorWrapper',
'SensorService'
]

monkey_patch()
use_select_poll_workaround(nose_only=False)


Expand Down
5 changes: 3 additions & 2 deletions st2reactor/tests/unit/test_sensor_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@

from __future__ import absolute_import

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import os
import unittest2

import six
import mock
import eventlet

from st2common.util.monkey_patch import monkey_patch
monkey_patch()

import st2tests.config as tests_config
from st2tests.base import TESTS_CONFIG_PATH
Expand Down