Fixed stack-overflow that has been happening due to gevent unpatched imports

This commit is contained in:
VakarisZ 2021-05-25 10:21:27 +03:00
parent 057a579d62
commit 5b7329b3d1
2 changed files with 11 additions and 7 deletions

View File

@ -1,14 +1,12 @@
from gevent import monkey as gevent_monkey
import monkey_island.cc.environment.environment_singleton as env_singleton # noqa: E402
from monkey_island.cc.arg_parser import parse_cli_args
from monkey_island.setup.config_setup import setup_config_by_cmd_arg, setup_default_config
gevent_monkey.patch_all()
# This import patches other imports and needs to be first
import monkey_island.setup.gevent_setup # noqa: E402 F401 isort:skip
import json # noqa: E402
import monkey_island.cc.environment.environment_singleton as env_singleton # noqa: E402
from monkey_island.cc.arg_parser import parse_cli_args
from monkey_island.cc.server_utils.island_logger import setup_logging # noqa: E402
from monkey_island.setup.config_setup import setup_config_by_cmd_arg, setup_default_config
if "__main__" == __name__:
island_args = parse_cli_args()

View File

@ -0,0 +1,6 @@
from gevent import monkey as gevent_monkey
# We need to monkeypatch before any other imports to
# make standard libraries compatible with gevent.
# http://www.gevent.org/api/gevent.monkey.html
gevent_monkey.patch_all()