Skip to content

Bad host

David Vorick requested to merge bad-host into master

MERGE REQUEST

Overview

Some of the (very old) host code was misusing threadgroups. For whatever reason, the tests I was running last night caught these misuses and caused some deadlocks, enabling me to follow the stack trace and find these bugs.

Not sure how they went undetected for so long, but they are only at play during shutdown. These may well be the source of some of our timeout NDFs.

Core issue is that tg.Add() can block for tg.OnStop() and tg.AfterStop() if the host is closed at an unfortunate timing. If the host is locked while calling tg.Add(), and then tg.OnStop() runs and fails to acquire a lock, it'll deadlock because the tg.Add() thread is holding the lock and will never release it.

Checklist

Review and complete the checklist to ensure that the MR is complete before assigned to an approver.

  • All new methods, or updating methods have clear docstrings
  • Testing added or updated for new methods
  • Any new packages are added to Makefile and .gitlab-ci.yml
  • API documentation updated for API updates
  • Module README.md updated for changes to work flow
  • Issue added to Sia-UI repo for new supporting features
  • Changelog updated

Merge request reports