8000 Unused "internet_access" checks cause annoying delays · Issue #1402 · guardicore/monkey · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unused "internet_access" checks cause annoying delays #1402
Closed
@mssalvatore

Description

@mssalvatore

Describe the bug

When the monkey agent starts, it performs a check to see if it has access to the internet. If the agent does not have internet access, this can cause the monkey agent to hang for 30-60 seconds, which adds significant delay to the blackbox test suite. It also slows down the overall propagation of the monkey and delays user feedback.

We've attempted to prevent this check from running by removing the URLs/IPs from the internet_services config field (#1371), but this did not stop the checks. This is because these checks are run before the agent contacts the island to receive a new configuration. The agent uses the default configuration, which includes the URLs and performs the checks.

As far as I can tell, the agent checks for internet access so it can send this information to the island. However, this information is never used. Below are all of the references to internet_access that I could find:

ControlClient.wakeup(parent=self._parent)
ControlClient.load_control_config()

def wakeup(parent=None, has_internet_access=None):
if parent:
LOG.debug("parent: %s" % (parent,))
hostname = gethostname()
if not parent:
parent = GUID
if has_internet_access is None:
has_internet_access = check_internet_access(WormConfiguration.internet_services)
monkey = {
"guid": GUID,
"hostname": hostname,
"ip_addresses": local_ips(),
"description": " ".join(platform.uname()),
"internet_access": has_internet_access,
"config": WormConfiguration.as_dict(),
"parent": parent,
"launch_time": str(datetime.now().strftime(DEFAULT_TIME_FORMAT)),
}
if ControlClient.proxies:
monkey["tunnel"] = ControlClient.proxies.get("https")
requests.post( # noqa: DUO123
"https://%s/api/monkey" % (WormConfiguration.current_server,),
data=json.dumps(monkey),

internet_access = BooleanField()

I have been unable to find any code that uses the internet_access field from the monkey model.

To Reproduce

See #1371 for more information

Suggested solutions

I recommend we remove this capability, as it causes delays in monkey propagation and adds no value.

Tasks

  • Remove dead code, build binaries, run blackbox tests. Compare before and after runtimes for the whole test suite. (0d) @mssalvatore
  • Run a test and inspect reports to ensure nothing broke. (0d) @mssalvatore

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0