Project

General

Profile

Actions

Bug #17349

closed

Rake での並行実行における正規表現マッチングの異常

Added by shuujii (Shuji KOBAYASHI) over 3 years ago. Updated almost 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
[ruby-dev:50972]

Description

小さな再現コードが作成できなかったのですが、以下のように Rake で並行実行すると正規表現のマッチングがおかしくなることがあるように見えます。

再現手順

$ git clone https://github.com/mruby/mruby
$ cd mruby
$ git checkout 0cb3a718
$ rake -m CONFIG=boxing clean gensym
Cleaned up target build folder
GEN   build/boxing-no-m64-i32/presym
GEN   build/boxing-no-m64-i32/include/mruby/presym.inc
GEN   build/boxing-no-m32-i32/presym
GEN   build/boxing-no-m32-i64/presym
(snip)
rake aborted!
NoMethodError: undefined method `*' for nil:NilClass
/mruby/tasks/presym.rake:81:in `block (4 levels) in <top (required)>'
/mruby/tasks/presym.rake:80:in `map'
/mruby/tasks/presym.rake:80:in `block (3 levels) in <top (required)>'
/mruby/tasks/presym.rake:69:in `map'
/mruby/tasks/presym.rake:69:in `block (2 levels) in <top (required)>'
Tasks: TOP => gensym => /mruby/build/boxing-no-m64-i64/presym
(See full trace by running task with --trace)
rake aborted!

エラーが発生しているのは以下の部分です。

https://github.com/mruby/mruby/blob/13fc5034345ae159f034849cb3f235f4463edd45/tasks/presym.rake#L80-L82

prefixsuffix の値がおかしくなっているために、macro_to_symbol[[prefix, suffix]]nil なり例外になっています。本来であればこの値は nil にならないはずのものです。

補足

  • rake-m を付けないで並行実行にしなければ発生しません。
  • こちらの環境では少なくとも30回に1回くらいは上記のエラーが発生します。
  • 正規表現のマッチ結果は上記とは違う異常になることもあるようです。

Files

cfiles.rb (33.6 KB) cfiles.rb self contained example of bug jeremyevans0 (Jeremy Evans), 08/13/2021 08:12 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #17507: Regexp capture groups ignored sometimes in some multithreaded environments (possible race condition)ClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0