fluent-plugins-nursery / fluent-plugin-systemd

This is a fluentd input plugin. It reads logs from the systemd journal.
Apache License 2.0
153 stars 43 forks source link

Plugin crash during graceful shutdown #95

Open fadlinurhasan opened 2 years ago

fadlinurhasan commented 2 years ago

Hi Team,

We face below errors when try to restart the td-agent. It seems related to the latest changes when @journal set to nil. This issue appear intermittently. Do you have solution for this case?

OS Version: Ubuntu 20.04 td-agent version: 4.3.0-1 fluent-plugin-systemd version: 1.0.5

Thanks

2021-12-10 17:03:35 +0700 [info]: Received graceful stop
2021-12-10 17:03:35 +0700 [info]: Received graceful stop
2021-12-10 17:03:35 +0700 [info]: #0 fluentd worker is now stopping worker=0
2021-12-10 17:03:35 +0700 [info]: #0 shutting down fluentd worker worker=0
2021-12-10 17:03:35 +0700 [info]: #0 shutting down input plugin type=:systemd plugin_id="object:c01c"
2021-12-10 17:03:35 +0700 [error]: #0 Unexpected error raised. Stopping the timer. title=:in_systemd_emit_worker error_class=NoMethodError error="undefined method `cursor' for nil:NilClass"
  2021-12-10 17:03:35 +0700 [error]: #0 /opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-systemd-1.0.5/lib/fluent/plugin/in_systemd.rb:151:in `yield_current_entry'
  2021-12-10 17:03:35 +0700 [error]: #0 /opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-systemd-1.0.5/lib/fluent/plugin/in_systemd.rb:144:in `watch'
  2021-12-10 17:03:35 +0700 [error]: #0 /opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-systemd-1.0.5/lib/fluent/plugin/in_systemd.rb:121:in `run'
  2021-12-10 17:03:35 +0700 [error]: #0 /opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.14.3/lib/fluent/plugin_helper/timer.rb:80:in `on_timer'
  2021-12-10 17:03:35 +0700 [error]: #0 /opt/td-agent/lib/ruby/gems/2.7.0/gems/cool.io-1.7.1/lib/cool.io/loop.rb:88:in `run_once'
  2021-12-10 17:03:35 +0700 [error]: #0 /opt/td-agent/lib/ruby/gems/2.7.0/gems/cool.io-1.7.1/lib/cool.io/loop.rb:88:in `run'
  2021-12-10 17:03:35 +0700 [error]: #0 /opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.14.3/lib/fluent/plugin_helper/event_loop.rb:93:in `block in start'
  2021-12-10 17:03:35 +0700 [error]: #0 /opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.14.3/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
2021-12-10 17:03:35 +0700 [error]: #0 Timer detached. title=:in_systemd_emit_worker
2021-12-10 17:03:35 +0700 [info]: #0 shutting down input plugin type=:systemd plugin_id="object:c008"
2021-12-10 17:03:35 +0700 [info]: #0 shutting down input plugin type=:tail plugin_id="object:bfe0"