Death by regexp_replace

From: Benedikt Grundmann <bgrundmann(at)janestreet(dot)com>
To: PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: Death by regexp_replace
Date: 2016-01-15 15:12:28
Message-ID: CADbMkNPR+zftNEWVeFxDALbqTY7grZzErKG29p=bS3wDZxyD2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

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

Cheers,

Bene

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-01-15 15:17:02 Re: Proposal: BSD Authentication support
Previous Message Tom Lane 2016-01-15 14:58:36 Re: Limit and inherited tables

Browse pgsql-www by date

  From Date Subject
Next Message Robert Haas 2016-01-15 15:25:32 Re: Death by regexp_replace
Previous Message Damien Clochard 2016-01-14 21:38:06 Re: Wiki access warning?