Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused "internet_access" checks cause annoying delays #1402

Closed
2 tasks done
mssalvatore opened this issue Aug 5, 2021 · 0 comments · Fixed by #1420
Closed
2 tasks done

Unused "internet_access" checks cause annoying delays #1402

mssalvatore opened this issue Aug 5, 2021 · 0 comments · Fixed by #1420
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Code Quality Deficiencies in code quality Complexity: Medium Feature removal Impact: High sp/2

Comments

@mssalvatore
Copy link
Collaborator

mssalvatore commented Aug 5, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Code Quality Deficiencies in code quality Complexity: Medium Feature removal Impact: High sp/2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant