Re: Uninterruptable regexp_replace in 9.3.1 ?

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org, strk(at)keybit(dot)net
Subject: Re: Uninterruptable regexp_replace in 9.3.1 ?
Date: 2014-02-21 15:46:45
Message-ID: 530774E5.5040105@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 02/21/2014 05:17 PM, Sandro Santilli wrote:
> The following snippet reveals that 9.3.1 has a bug
> in regexp_matches, which uninterruptably keeps CPU
> spinning for minutes:

Huh. So it does. That's interesting.

(You should generally report things to pgsql-bugs(at)postgresql(dot)org btw,
not -hackers)

Looks like it's busily looping within the regex.c code, never hitting a
CHECK_FOR_INTERRUPTS.

The real question IMO is why it's taking so long. It looks like
cfindloop(...) is being called multiple times, with each call taking a
couple of seconds.

A profile of the run is attached. I don't expect to have a chance to dig
into this right away, as I haven't touched the regexp code before and
would need to spend a bit of time studying it to achieve anything.
Hopefully the test, confirmation, and profile is useful.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
perf.report text/plain 10.6 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Florian Pflug 2014-02-21 16:04:04 Re: Uninterruptable regexp_replace in 9.3.1 ?
Previous Message Alvaro Herrera 2014-02-21 13:47:14 Re: Is there a Support Platforms document more current that this?

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Browne 2014-02-21 15:52:06 Re: Storing the password in .pgpass file in an encrypted format
Previous Message Andres Freund 2014-02-21 15:37:35 Re: Storing the password in .pgpass file in an encrypted format