pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@2ndquadrant.com>
To: pgsql-hackers@postgresql.org
To: strk@keybit.net
Subject: Re: Uninterruptable regexp_replace in 9.3.1 ?
Date: Fri, 21 Feb 2014 23:46:45 +0800
Message-ID: <530774E5.5040105@2ndquadrant.com> (raw)
In-Reply-To: <20140221091759.GK6924@localhost>
References: <20140221091759.GK6924@localhost>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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@postgresql.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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

perf.report (text/plain, 10.6K) download # Overhead Command Shared Object Symbol # ........ ........ ................. ............................................... # 40.33% postgres postgres [.] longest | --- longest cdissect cdissect cdissect cdissect cdissect cdissect | |--87.25%-- cdissect | | | |--78.14%-- cdissect | | | | | |--81.92%-- cdissect | | | | | | | |--68.07%-- cdissect | | | | | | | | | |--69.11%-- pg_regexec | | | | | | | | | --30.89%-- cdissect | | | | pg_regexec | | | | | | | --31.93%-- pg_regexec | | | | | --18.08%-- pg_regexec | | | --21.86%-- pg_regexec | --12.75%-- pg_regexec 19.20% postgres postgres [.] shortest | --- shortest cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect pg_regexec 12.76% postgres postgres [.] miss | --- miss | |--88.87%-- longest | cdissect | cdissect | cdissect | cdissect | cdissect | cdissect | | | |--93.47%-- cdissect | | | | | |--74.23%-- cdissect | | | | | | | |--90.21%-- cdissect | | | | | | | | | |--85.39%-- cdissect | | | | | | | | | | | |--91.67%-- pg_regexec | | | | | | | | | | | --8.33%-- cdissect | | | | | pg_regexec | | | | | | | | | --14.61%-- pg_regexec | | | | | | | --9.79%-- pg_regexec | | | | | --25.77%-- pg_regexec | | | --6.53%-- pg_regexec | --11.13%-- shortest cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect pg_regexec 11.25% postgres postgres [.] initialize | --- initialize | |--79.73%-- longest | cdissect | cdissect | cdissect | cdissect | cdissect | cdissect | | | |--84.41%-- cdissect | | | | | |--77.74%-- cdissect | | | | | | | |--84.58%-- cdissect | | | | | | | | | |--77.37%-- cdissect | | | | | | | | | | | |--77.89%-- pg_regexec | | | | | | | | | | | --22.11%-- cdissect | | | | | pg_regexec | | | | | | | | | --22.63%-- pg_regexec | | | | | | | --15.42%-- pg_regexec | | | | | --22.26%-- pg_regexec | | | --15.59%-- pg_regexec | --20.27%-- shortest cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect cdissect pg_regexec 7.99% postgres postgres [.] cdissect | --- cdissect cdissect cdissect cdissect cdissect cdissect | |--83.49%-- cdissect | | | |--87.88%-- cdissect | | | | | |--90.92%-- cdissect | | | | | | | |--87.15%-- cdissect | | | | | | | | | |--66.36%-- pg_regexec | | | | | | | | | --33.64%-- cdissect | | | | | | | | | |--50.37%-- cdissect | | | | | pg_regexec | | | | | | | | | --49.63%-- pg_regexec | | | | | | | --12.85%-- pg_regexec | | | | | --9.08%-- pg_regexec | | | --12.12%-- pg_regexec | --16.51%-- pg_regexec 6.05% postgres postgres [.] zaptreesubs | --- zaptreesubs | |--53.05%-- zaptreesubs | | | |--63.17%-- cdissect | | cdissect | | cdissect | | cdissect | | cdissect | | cdissect | | | | | |--60.72%-- pg_regexec | | | | | --39.28%-- cdissect | | cdissect | | cdissect | | cdissect | | pg_regexec | | | --36.83%-- zaptreesubs | | | |--89.96%-- cdissect | | cdissect | | cdissect | | cdissect | | cdissect | | cdissect | | pg_regexec | | | --10.04%-- zaptreesubs | cdissect | cdissect | cdissect | cdissect | cdissect | cdissect | pg_regexec | --46.95%-- cdissect cdissect cdissect cdissect cdissect cdissect | |--79.77%-- cdissect | cdissect | cdissect | cdissect | pg_regexec | --20.23%-- pg_regexec

view thread (9+ messages)  latest in thread

Message-ID: <530774E5.5040105@2ndquadrant.com>
Permalink:  ../530774E5.5040105@2ndquadrant.com/
Also on:    postgresql.org/message-id/530774E5.5040105@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: craig@2ndquadrant.com, pgsql-hackers@postgresql.org, strk@keybit.net
  Subject: Re: Uninterruptable regexp_replace in 9.3.1 ?
  In-Reply-To: <530774E5.5040105@2ndquadrant.com>
  References: <20140221091759.GK6924@localhost> <530774E5.5040105@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox