Message334949
These work fine and return instantly:
python -c "import re; re.compile('.*x').match('y'*(1000*100))"
python -c "import re; re.compile('x').search('y'*(1000*100))"
python -c "import re; re.compile('.*x').search('y'*(1000*10))"
This hangs / freezes / livelocks indefinitely, with lots of CPU usage:
python -c "import re; re.compile('.*x').search('y'*(1000*100))"
Admittedly performing a search() with a pattern starting .* isn't useful, however it's worth fixing as:
- it's easily done by inexperienced developers, or users interacting with code that's far removed from the actual regex call
- the failure mode of hanging forever (with the GIL held, of course) is quite severe (took us a lot of debugging with gdb before we figured out where our complex multi-threaded python program was hanging!), and
- the fact that the behaviour is different based on the length of the string being matched suggests there is some kind of underlying bug in how the buffer is handled whcih might also affect other, more reasonable regex use cases |
|
Date |
User |
Action |
Args |
2019-02-06 16:17:40 | benspiller | set | recipients:
+ benspiller, ezio.melotti, mrabarnett |
2019-02-06 16:17:37 | benspiller | set | messageid: <1549469857.93.0.911634458861.issue35915@roundup.psfhosted.org> |
2019-02-06 16:17:37 | benspiller | link | issue35915 messages |
2019-02-06 16:17:37 | benspiller | create | |
|