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

[bug]: ChannelArbitrator does not cleanly stop #8149

Open
Crypt-iQ opened this issue Nov 3, 2023 · 0 comments · May be fixed by #9253 or #9264
Open

[bug]: ChannelArbitrator does not cleanly stop #8149

Crypt-iQ opened this issue Nov 3, 2023 · 0 comments · May be fixed by #9253 or #9264
Labels
bug Unintended code behaviour P3 might get fixed, nice to have

Comments

@Crypt-iQ
Copy link
Collaborator

Crypt-iQ commented Nov 3, 2023

When a ChannelArbitrator is finished with its duties, it attempts to stop itself but can't:

The channelAttendant goroutine calls advanceState which calls stateStep which hits this line if the state is StateFullyResolved:

if err := c.cfg.MarkChannelResolved(); err != nil {
log.Errorf("unable to mark channel resolved: %v", err)
return StateError, closeTx, err
}

MarkChannelResolved calls ResolveContract:

arbCfg.MarkChannelResolved = func() error {
if c.cfg.NotifyFullyResolvedChannel != nil {
c.cfg.NotifyFullyResolvedChannel(chanPoint)
}
return c.ResolveContract(chanPoint)

ResolveContract calls Stop on the ChannelArbitrator:

if chainArb != nil {
arbLog = chainArb.log
if err := chainArb.Stop(); err != nil {
log.Warnf("unable to stop ChannelArbitrator(%v): %v",
chanPoint, err)
}

This will close the quit channel and wait for the waitgroup counter to go to zero. However, because this can be called from channelAttendant, the goroutine is waiting for itself to be cleaned up and will just hang. This doesn't cause the node to be unresponsive, but the ChannelArbitrator will sit there and not properly stop.

h/t @bitromortac

@Crypt-iQ Crypt-iQ added the bug Unintended code behaviour label Nov 3, 2023
@saubyk saubyk added P2 should be fixed if one has time P3 might get fixed, nice to have and removed P2 should be fixed if one has time labels Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended code behaviour P3 might get fixed, nice to have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants