Fix incomplete extension state when failing to initialize.

Review Request #11136 — Created Aug. 12, 2020 and submitted — Latest diff uploaded

Information

Djblets
release-2.0.x

Reviewers

Extensions could end up in a half-loaded state if something went wrong
(such as a static media permission issue) during extension
initialization. They'd be removed from the list of initialized
extensions, but by this time they'd have instantiated and likely
registered hooks. This meant that subsequent attempts would make further
attempts to set up those hooks, causing more and more entries to pile
up. This could lead to the server getting swamped, and could cause all
sorts of page breakages, or other kinds of errors.

The extension manager now takes a more thorough approach to
uninitializing extensions when they fail. It performs a full
_uninit_extension on them, which itself gracefully handles any issues
that might come up while attempting to uninitialize. This ensures that
every part of the extension we have any control over will be removed
from the extension manager and from memory.

Unit tests pass.

Commits

Files