⚠️ This PR is based on the changes included in #38.
While running multiple logstash pipelines we found an issue when multiple pipelines try to register (concurrently) the same dependency of class_name. This leads to unrecoverable errors that prevent the pipeline from starting with a RuntimeError similar to:
...
:exception=>"RuntimeError",
:message=>"trivago__DOT__logging__ProtoMyClass.header: \"header\" is already defined in \"trivago__DOT__logging__ProtoMyClass\".
...
or a different one where header dependency is not defined at all.
This happens because the DescriptorPool (generated_pool in the JRuby wrapper) it is not thread-safe (while loading protobuf classes) and it is shared between all pipelines in the same instance.
This PR adds a mutex around the loading protobuf in the register method, which means that each pipeline has exclusive access to the DescriptorPool when registering the main class and its dependencies.
The plugin is now marked as non-reloadable. If a pipeline receives a reload action the plugin will fail to register again since all definitions are already present in the DescriptorPool. Additionally, all protobuf classes/enums are registered globally and the JRuby wrapper checks the availability of the names.
⚠️ This PR is based on the changes included in #38.
While running multiple logstash pipelines we found an issue when multiple pipelines try to register (concurrently) the same dependency of
class_name
. This leads to unrecoverable errors that prevent the pipeline from starting with aRuntimeError
similar to:This happens because the
DescriptorPool
(generated_pool
in the JRuby wrapper) it is not thread-safe (while loading protobuf classes) and it is shared between all pipelines in the same instance.This PR adds a mutex around the loading protobuf in the
register
method, which means that each pipeline has exclusive access to theDescriptorPool
when registering the main class and its dependencies.The plugin is now marked as non-reloadable. If a pipeline receives a reload action the plugin will fail to register again since all definitions are already present in the
DescriptorPool
. Additionally, all protobuf classes/enums are registered globally and the JRuby wrapper checks the availability of the names.