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

Don't fail completely when PowerManager.init/1 raises #259

Merged
merged 1 commit into from
Nov 21, 2020

Conversation

fhunleth
Copy link
Member

When PowerManager.init/1 implementations fail, supervision restarts
GenServers like expected. However, init/1 really isn't supposed to
fail and when it does, it has the effect of propogating failures all the
way up which eventually takes down VintageNet. While this is almost
certainly a programming error, the result is particularly harsh.

To better support debugging this issue, this commit logs the error and
disables the power manager.

The downside to this is that if there's a transient that would have been
fixed by a restart, that no longer happens and perhaps the network won't
work. While this isn't good, devices that require network connections
to function need to have a "watchdog" that verifies that there's a
network connection anyway. That logic should catch this.

When `PowerManager.init/1` implementations fail, supervision restarts
GenServers like expected. However, `init/1` really isn't supposed to
fail and when it does, it has the effect of propogating failures all the
way up which eventually takes down VintageNet. While this is almost
certainly a programming error, the result is particularly harsh.

To better support debugging this issue, this commit logs the error and
disables the power manager.

The downside to this is that if there's a transient that would have been
fixed by a restart, that no longer happens and perhaps the network won't
work.  While this isn't good, devices that require network connections
to function need to have a "watchdog" that verifies that there's a
network connection anyway. That logic should catch this.
@fhunleth fhunleth merged commit c1865b0 into main Nov 21, 2020
@fhunleth fhunleth deleted the power-manager-init-exception branch November 21, 2020 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants