opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

Collector Shutdown should block until Run cleans up

Open cpheps opened this issue 3 years ago • 14 comments

Is your feature request related to a problem? Please describe. Discussion from 4878 led to a decision to design Shutdown to follow language patterns for how it and Run should operate. Following http.Server as an example the following behaviors should be met:

  1. Shutdown be safe to be called at any point. Even if there is no action to take
  2. If Shutdown is called before Run it will exit cleanly and the next call to Run will exit due to the previous Shutdown
  3. If Shutdown is called while Run is active it should block until Run has confirmed shutdown.

Point 3 isn't currently implemented but desired behavior.

Describe the solution you'd like Shutdown will block until Run has confirmed cleanup. Whatever Shutdown checks for should not stop it from cleanly exiting if Run hasn't been called yet or after Run was called.

Describe alternatives you've considered Alternative is don't block Shutdown and just exit like it does now after closing the channel.

Additional context Action item from #4878

If we want to go this route I think there needs to be some discussion on what Shutdown should block on. It seems like it should be when the state is Closing but that won't allow Shutdown to cleanly exit if called before or after Run.

cpheps avatar Mar 02 '22 19:03 cpheps

@djaglowski said it can be upstreamed

dmitryax avatar Mar 25 '22 17:03 dmitryax

Following up on this - I misunderstood the context of this issue, #4946, and 4939, and mistakenly believed they may have been resolved as part of #4878.

djaglowski avatar Apr 08 '22 14:04 djaglowski

Can I work on this?

deepto98 avatar Jul 04 '22 06:07 deepto98

@deepto98 sure. Assigned to you. Thanks

dmitryax avatar Jul 04 '22 22:07 dmitryax

Hi @deepto98, are you still working on this? I would like to take this up

Chinwendu20 avatar Oct 12 '22 04:10 Chinwendu20

Hi @cpheps I guess 1 and 2 has been addressed by other the other issues

Chinwendu20 avatar Oct 12 '22 04:10 Chinwendu20

going to take a look at this

michalpristas avatar Nov 07 '23 10:11 michalpristas