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

Our run group idiom is confusing #1205

Open
directionless opened this issue May 22, 2023 · 3 comments
Open

Our run group idiom is confusing #1205

directionless opened this issue May 22, 2023 · 3 comments

Comments

@directionless
Copy link
Contributor

directionless commented May 22, 2023

Digging through a debug log, I find myself wondering about

func (u *updaterCmd) interrupt(err error) {
level.Info(u.config.Logger).Log("msg", "updater interrupted", "err", err)
// non-blocking channel send
select {
case u.stopChan <- true:
level.Info(u.config.Logger).Log("msg", "updater interrupt sent signal over stop channel")
default:
level.Info(u.config.Logger).Log("msg", "updater interrupt without sending signal over stop channel (no one to receive)")
}
if u.stopExecution != nil {
u.stopExecution()
}
}

This is the interrupt function for the updater. u.stopExecution() makes sense, but signaling u.stopChan <- true feels weird. That stops the main launcher thread, which should have it's own interrupt function. I might be missing something clever, but my hunch is that it's superfluous.

@RebeccaMahany
Copy link
Contributor

Investigated -- u.stopChan is a separate channel from the sigChannel that gets passed in, so signaling u.stopChan only stops the updater from attempting to init an autoupdater if it hasn't yet, and does not stop the main launcher thread.

Discussed offline the need for better logging and reporting for when our many rungroups exit.

@directionless directionless changed the title Something feels off in the run group Our run group idiom is confusing May 30, 2023
@directionless
Copy link
Contributor Author

Thank you for digging through that Becca!

My sense here, is that part of what's confusing is that we don't have clear enough logging around what happens. (And this is because the rungroup idiom feels like it's missing something)

Inturrupt takes an err which is meant to be the err of the thing triggering the exit. But that feels like it's a bit weird? why would some routine care why it's being asked to exit. 🤷 maybe sometimes it wants to trigger an extra cleanup routine.

But I think one of the cores here, is that we don't log consistently. When something starts, or when it's interrupted, and why are all very muddled. My gut sense is that we should write a replacement (or wrapper) for oklog/run that adds some simple logging and cleans up the interfaces

@RebeccaMahany
Copy link
Contributor

RebeccaMahany commented Aug 1, 2023

Some specific wishlist items while working through #1272:

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

No branches or pull requests

2 participants