File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
src/main/java/org/truffleruby/language/control Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ Bug fixes:
7
7
encoding and has non-ASCII characters.
8
8
* Fixed ` puts ` for strings with non-ASCII-compatible encodings.
9
9
* ` rb_protect ` now returns ` Qnil ` when an error occurs.
10
+ * Fixed a race condition when using the interpolate-once (` /o ` ) modifier in
11
+ regular expressions.
10
12
11
13
New features:
12
14
Original file line number Diff line number Diff line change @@ -35,7 +35,11 @@ public Object execute(VirtualFrame frame) {
35
35
if (value == null ) {
36
36
CompilerDirectives .transferToInterpreterAndInvalidate ();
37
37
synchronized (this ) {
38
- if (cachedValue == null ) {
38
+ // Read `cachedValue` again to check if the value was updated by another thread while this thread
39
+ // was waiting on the lock. If it's still null, this thread is the first one to get the lock and
40
+ // must update the cache.
41
+ value = cachedValue ;
42
+ if (value == null ) {
39
43
value = cachedValue = child .execute (frame );
40
44
assert value != null ;
41
45
}
You can’t perform that action at this time.
0 commit comments