logstash-plugins / logstash-filter-jdbc_static

Loads a DB query's result set in memory and uses it as lookup table for events.
Apache License 2.0
11 stars 12 forks source link

Pipeline reloads cause multiple scheduler threads to be created #33

Closed robbavey closed 6 years ago

robbavey commented 6 years ago

When a pipeline is reloaded, a configuration setup with a scheduler will not shut down the existing scheduler, and will create a new scheduler each time the plugin restarts.

This can cause issues with where https://github.com/logstash-plugins/logstash-filter-jdbc_static/blob/35992126f37f9fad0b3f7f51d34597d0ba7f99d7/lib/logstash/filters/jdbc/read_write_database.rb#L57 is accessed concurrently by multiple scheduler threads, potentially leading to the following error:

11:30:02.904 [Ruby-0-Thread-68: /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:284] ERROR logstash.filters.jdbc.readwritedatabase - Exception when filling lookup db from loader test, query results, original exception: Sequel::DatabaseError, original message: Java::JavaSql::SQLException: The exception 'java.sql.SQLException: Data file not found: /home/users/robbavey/test' 

This issue is likely the cause of https://github.com/elastic/support-dev-help/issues/4169