Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def before_run
@rpc_server = nil
@counter = nil

@fluentd_lock_dir = Dir.mktmpdir("fluentd-lock-")
ENV['FLUENTD_LOCK_DIR'] = @fluentd_lock_dir

if config[:rpc_endpoint]
@rpc_endpoint = config[:rpc_endpoint]
@enable_get_dump = config[:enable_get_dump]
Expand Down Expand Up @@ -79,9 +82,15 @@ def after_run
stop_windows_event_thread if Fluent.windows?
stop_rpc_server if @rpc_endpoint
stop_counter_server if @counter
cleanup_lock_dir
Fluent::Supervisor.cleanup_resources
end

def cleanup_lock_dir
FileUtils.rm(Dir.glob(File.join(@fluentd_lock_dir, "fluentd-*.lock")))
FileUtils.rmdir(@fluentd_lock_dir)
end

def run_rpc_server
@rpc_server = RPC::Server.new(@rpc_endpoint, $log)

Expand Down Expand Up @@ -876,10 +885,7 @@ def supervise
Fluent::Supervisor.load_config(@config_path, params)
}

Dir.mktmpdir("fluentd-lock-") do |lock_dir|
ENV['FLUENTD_LOCK_DIR'] = lock_dir
se.run
end
se.run
end

def install_main_process_signal_handlers
Expand Down