From 1c86eb6a84ac3820174952da5f6ee8d00a7a9bdb Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Wed, 8 Jul 2026 18:23:40 +0900 Subject: [PATCH] in_sql: add nil guard in shutdown `@thread` is assigned only on the last line of `#start`, so any shutdown that runs on an instance whose `#start` never reached that line calls `@thread.join` on nil and raises "undefined method `join' for nil:NilClass". Signed-off-by: Shizuo Fujita --- lib/fluent/plugin/in_sql.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fluent/plugin/in_sql.rb b/lib/fluent/plugin/in_sql.rb index 5dc040f..2478bd1 100644 --- a/lib/fluent/plugin/in_sql.rb +++ b/lib/fluent/plugin/in_sql.rb @@ -248,8 +248,10 @@ def start def shutdown @stop_flag = true - $log.debug "Waiting for thread to finish" - @thread.join + if @thread + $log.debug "Waiting for thread to finish" + @thread.join + end end def thread_main