diff --git a/lib/datadog/appsec/processor.rb b/lib/datadog/appsec/processor.rb index ceebbfa8d81..e439e625e9e 100644 --- a/lib/datadog/appsec/processor.rb +++ b/lib/datadog/appsec/processor.rb @@ -14,9 +14,12 @@ def initialize(processor) @time_ext_ns = 0.0 @timeouts = 0 @events = [] + @run_mutex = Mutex.new end def run(input, timeout = WAF::LibDDWAF::DDWAF_RUN_TIMEOUT) + @run_mutex.lock + start_ns = Core::Utils::Time.get_time(:nanosecond) # TODO: remove multiple assignment @@ -30,6 +33,8 @@ def run(input, timeout = WAF::LibDDWAF::DDWAF_RUN_TIMEOUT) @timeouts += 1 if res.timeout res + ensure + @run_mutex.unlock end def finalize diff --git a/sig/datadog/appsec/processor.rbs b/sig/datadog/appsec/processor.rbs index 94cecee5733..2e5e281bcb3 100644 --- a/sig/datadog/appsec/processor.rbs +++ b/sig/datadog/appsec/processor.rbs @@ -12,6 +12,8 @@ module Datadog @context: WAF::Context + @run_mutex: ::Thread::Mutex + def initialize: (Processor processor) -> void def run: (data input, ?::Integer timeout) -> WAF::Result def finalize: () -> void