Skip to content

Do not cache non-"once" dregexp#6996

Merged
headius merged 1 commit intojruby:jruby-9.3from
headius:no_cache_dregexp
Jan 14, 2022
Merged

Do not cache non-"once" dregexp#6996
headius merged 1 commit intojruby:jruby-9.3from
headius:no_cache_dregexp

Conversation

@headius
Copy link
Member

@headius headius commented Jan 14, 2022

The cache here serves as a cache for dynamic "once" regexps but
is also being used as the holder for non-"once" regexp. This leads
to a concurrency issue since a single field in this instruction is
used across threads and they may step on each other.

This patch avoids using the shared field for non-"once" dynamic
regexps. As a side effect, these instruction instances will not
be queriable for their last-built RubyRegexp, which also seems
appropriate if they are not a "once" dregexp.

Fixes #6992

The cache here serves as a cache for dynamic "once" regexps but
is also being used as the holder for non-"once" regexp. This leads
to a concurrency issue since a single field in this instruction is
used across threads and they may step on each other.

This patch avoids using the shared field for non-"once" dynamic
regexps. As a side effect, these instruction instances will not
be queriable for their last-built RubyRegexp, which also seems
appropriate if they are not a "once" dregexp.

Fixes jruby#6992
@headius headius added this to the JRuby 9.3.3.0 milestone Jan 14, 2022
@headius headius merged commit c7582a1 into jruby:jruby-9.3 Jan 14, 2022
@headius headius deleted the no_cache_dregexp branch January 14, 2022 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant