Skip to content

Commit 1c86eb6

Browse files
committed
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 <fujita@clear-code.com>
1 parent f7b106c commit 1c86eb6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/fluent/plugin/in_sql.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,10 @@ def start
248248

249249
def shutdown
250250
@stop_flag = true
251-
$log.debug "Waiting for thread to finish"
252-
@thread.join
251+
if @thread
252+
$log.debug "Waiting for thread to finish"
253+
@thread.join
254+
end
253255
end
254256

255257
def thread_main

0 commit comments

Comments
 (0)