[ruby-core:114548] [Ruby master Bug#18144] Timeout not working while regular expression match is running
From:
"jeremyevans0 (Jeremy Evans) via ruby-core" <ruby-core@...>
Date:
2023-08-25 17:06:22 UTC
List:
ruby-core #114548
Issue #18144 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Closed This issue appears fixed in Ruby 3.2, due to regexp optimizations by @maken= owjust. If there are regexps that are still experiencing this issue, pleas= e report them and we can reopen. ---------------------------------------- Bug #18144: Timeout not working while regular expression match is running https://bugs.ruby-lang.org/issues/18144#change-104350 * Author: duerst (Martin D=FCrst) * Status: Closed * Priority: Normal * ruby -v: various, see description * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- Experimenting with dozens of regular expressions that take a long time to m= atch against certain strings, I have found that for some regular expression= matches, Timeouts don't work at all (while they work for the rest without = problems). The attached file allows reproduction. On three different machines and with= six different versions of Ruby (see below), the attached file always showe= d about 20~25 seconds of execution time even though there was a Timeout int= erval of only 10s. If your machine is too fast so that the printed-out resu= lt comes in below or just a bit above 10s, then either lower the timeout du= ration (e.g. to 5s) or increase the length of the string (e.g. 80_000 -> 10= 0_000; caution, time increases with the second power of this number). The timeout uses `Timeout::timeout` and `rescue Timeout::Error` as describe= d in the pickaxe. Checked with the following versions/environments: - ruby 3.1.0dev (2021-06-03T06:59:33Z master 7e14762159) [x86_64-linux] on = Ubuntu on WSL on a Windows 10 notebook - ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-cygwin] on same notebo= ok - ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32] on same noteb= ook - ruby 3.1.0dev (2021-06-03T06:59:33Z master 7e14762159) [x86_64-linux] on = Ubuntu on WSL on same notebook - ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu] on a two= -CPU Dell server with Ubuntu - ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] on an older Dell= server with CentOS ---Files-------------------------------- no_timeout.rb (333 Bytes) --=20 https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-c= ore.ml.ruby-lang.org/