You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
There are a few lifecycle inconsistencies in the collector lifecycle management.
In Collector.Run the collector state is not updated if the collector errors on startup. Leaving the collector in a Starting state even though Run has excited with and error.
There's a race condition/panic in Collector.Shutdown if Shutdown is called before the logger is initialized it will panic in the Shutdownrecover.
Steps to reproduce
Call Collector.Run with a bad config and then call Collector.GetState to observe state is still Starting.
It's harder to reliably trigger the race condition but if you call Collector.Run with a bad config then call Collector.Shutdown it will have the same panic.
What did you expect to see?
State updates correctly changed to Closed or maybe a new Failed or Error state to indicate a failed startup.
Shutdown never panics no matter when it's called.
What did you see instead?
State is Started
Shutdown panics
What version did you use?
v0.43.0
What config did you use?
Any invalid configuration will work.
Environment
OS: macOS Monterey (12.2)
Compiler: go 1.17.6
Additional context
I'd be happy to submit a PR to fix the above I think the only open question is if the collector errors on startup should the state be Closed or should we introduce a new state to represent a failure?
It's a bit unclear how Collector.Run and Collector.GetState are supposed to be used by the caller. It seems like Run should be called an expected to block until the collector finishes (with or without an error). It's not clear if GetState is meant to be constantly monitored to help with managing a collector or if it's purely informational on what the collector is doing.
The text was updated successfully, but these errors were encountered:
Created a PR to fix the Shutdown race condition as that was straight forward and didn't require discussion. Keeping issue open as there still needs to be a decision on the collectors state when it fails to startup.
Describe the bug
There are a few lifecycle inconsistencies in the collector lifecycle management.
Collector.Run
the collector state is not updated if the collector errors on startup. Leaving the collector in aStarting
state even thoughRun
has excited with and error.Collector.Shutdown
ifShutdown
is called before the logger is initialized it will panic in theShutdown
recover.Steps to reproduce
Collector.Run
with a bad config and then callCollector.GetState
to observe state is stillStarting
.Collector.Run
with a bad config then callCollector.Shutdown
it will have the same panic.What did you expect to see?
Closed
or maybe a newFailed
orError
state to indicate a failed startup.Shutdown
never panics no matter when it's called.What did you see instead?
Started
Shutdown
panicsWhat version did you use?
v0.43.0
What config did you use?
Any invalid configuration will work.
Environment
OS: macOS Monterey (12.2)
Compiler: go 1.17.6
Additional context
I'd be happy to submit a PR to fix the above I think the only open question is if the collector errors on startup should the state be
Closed
or should we introduce a new state to represent a failure?It's a bit unclear how
Collector.Run
andCollector.GetState
are supposed to be used by the caller. It seems likeRun
should be called an expected to block until the collector finishes (with or without an error). It's not clear ifGetState
is meant to be constantly monitored to help with managing a collector or if it's purely informational on what the collector is doing.The text was updated successfully, but these errors were encountered: