logstash-plugins / logstash-filter-grok

Grok plugin to parse unstructured (log) data into something structured.
https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html
Apache License 2.0
122 stars 97 forks source link

Ensure RubyThread interrupts are Cleared #130

Closed original-brownbear closed 6 years ago

original-brownbear commented 6 years ago

RubyThread checks for interrupts with this code:

private boolean anyInterrupted() {
        return Thread.interrupted() || (interruptFlag & ~interruptMask) != 0;
    }

if we simply clear the Java thread, a subsequent invocation of Ruby code may still throw because the interrupted state wasn't cleared quickly enough on the RubyThread's interruptFlag as well.

=> Clear it via Thread.handle_interrupt (I put it in the conditional to avoid setting up the block on every call needlessly when there aren't any interrupts)

original-brownbear commented 6 years ago

@andrewvc no huge rush here I guess: but urgh the API here changed in JRuby 9k it seems :( => is this important enough to back port to 5.6? (if yes we could just add some conditional Ruby syntax and an eval to set up the interrupt clearing method I guess :))

andrewvc commented 6 years ago

@original-brownbear given that we're seeing this bug in 5.x now, I think that yes, we should support 5.x. My preference is not to backport it, since 5.x uses the same version of the filter here, but to use a conditional to use the correct API based on the current JRuby version.

andrewvc commented 6 years ago

Closing in favor of #131