Re: invalid regexp crashes the server on windows or 9.3 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: invalid regexp crashes the server on windows or 9.3
Date
Msg-id 26372.1380117086@sss.pgh.pa.us
Whole thread Raw
In response to Re: invalid regexp crashes the server on windows or 9.3  ("Erik Rijkers" <er@xs4all.nl>)
List pgsql-hackers
"Erik Rijkers" <er@xs4all.nl> writes:
> On Wed, September 25, 2013 09:33, Marc Mamin wrote:
>> This regexp call freezes with almost 100% CPU usage, so I guess it creates an infinite loop.
>> cic_db=# select regexp_matches ('aa bb aa ba baa x','(^((?!aa)))+','gx');

I poked into this a bit and decided that it's a variant of a problem we've
seen before.  I filed a report with the Tcl crew to see if they have any
opinion about it:
https://core.tcl.tk/tcl/tktview?name=8f245009b0
but prior experience suggests they won't be a lot of help.

> On 9.3 and 9.4devel, on linux (centos 6.4), that statement / regex returns after ~2 minutes (on a modest desktop)
withthat
 
> same error, but not crashing.

Yeah, it should in principle fail eventually with a too-many-states error,
since the loop is creating more NFA states than it deletes.  But on a Mac
laptop with an assert-enabled PG build, I got tired of waiting for that
after about an hour ...
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Cube extension kNN support
Next
From: Heikki Linnakangas
Date:
Subject: Re: Freezing without write I/O