Re: Death by regexp_replace

From: Jan de Visser <jan(at)de-visser(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Benedikt Grundmann <bgrundmann(at)janestreet(dot)com>
Cc: PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Death by regexp_replace
Date: 2016-01-15 15:30:04
Message-ID: 5699107C.8000705@de-visser.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

On 2016-01-15 10:25 AM, Robert Haas wrote:
> On Fri, Jan 15, 2016 at 10:12 AM, Benedikt Grundmann
> <bgrundmann(at)janestreet(dot)com> wrote:
>> Today we discovered that we had a backend whose client had gone away, the
>> automatic query watching process had send both pg_cancel and
>> pg_terminate_backend but nevertheless the process was sitting there
>> consuming resources and had been for over 1 day...
>>
>> gdb revealed that we were sitting in pg_regexec (we forced it to return 16
>> aka invalid regex to return our system into a good state).
>>
>> Here is the regular expression and the text to run on:
>>
>> WARNING DO NOT DO THIS ON A PRODUCTION BOX
>>
>> select regexp_replace('VODI GR,VOD LN,VOD LN,VODN MM,VODPF US,VOD US,VZC
>> LN', '([^,]+)(,*\1)+', '\1');
>>
>> This was in postgres 9.2
> 9.2.what? Tom just fixed a whole bunch of bugs in this area, so if
> you're running less than 9.2.14, please test whether this can be
> reproduced with that version.
>

I just tried this on 9.4.5 (stock Ubuntu 15.10 release), waited a minute
and killed the backend.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-01-15 15:33:52 Re: Death by regexp_replace
Previous Message Robert Haas 2016-01-15 15:25:32 Re: Death by regexp_replace

Browse pgsql-www by date

  From Date Subject
Next Message Tom Lane 2016-01-15 15:33:52 Re: Death by regexp_replace
Previous Message Robert Haas 2016-01-15 15:25:32 Re: Death by regexp_replace