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
Start telegraf with socket_listener input using tcp port
Spam the socket_listener (~ millisecond delay between connections)
Send SIGHUP to telegraf during (2)
Expected behavior:
socket_listener does not return from Stop() until all open connections are closed and parsers have parsed
Actual behavior:
telegraf panics because socket_listener's streamSocketListener read() go routine is still processing and adding metrics. The accumulator's metrics channel has been closed and panics when a new metric is added.
Additional info:
This was difficult to reproduce; you need a parser that isn't blazingly fast (protobuf in my case) so that you can squeeze a parse in between read() and close().
I wrote a quick fix that mimics the google PubSub input plugin below. I am concerned about blocking Stop(); perhaps a cancellable context could improve.
Blocking Stop would be fine right now, in the future we should add Context as an argument to the functions that are expected to block/wait. I think you should make the WaitGroup a non-pointer field, since the plugin should never be copied. Can you open a PR?
Relevant telegraf.conf:
System info:
telegraf 1.11.2 w/ additional plugins
Steps to reproduce:
Expected behavior:
socket_listener does not return from
Stop()
until all open connections are closed and parsers have parsedActual behavior:
telegraf panics because socket_listener's streamSocketListener
read()
go routine is still processing and adding metrics. The accumulator's metrics channel has been closed and panics when a new metric is added.Additional info:
This was difficult to reproduce; you need a parser that isn't blazingly fast (protobuf in my case) so that you can squeeze a parse in between read() and close().
I wrote a quick fix that mimics the google PubSub input plugin below. I am concerned about blocking
Stop()
; perhaps a cancellable context could improve.edited to move wg.Wait() to end of ssl.listen()
The text was updated successfully, but these errors were encountered: