Assert triggered during RE_compile_and_cache

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Assert triggered during RE_compile_and_cache
Date: 2021-08-05 20:38:58
Message-ID: 0203588E-E609-43AF-9F4F-902854231EE7@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom,

while testing your patch in [1], I stumbled upon the following assert in master, without your patch applied:

+select 'vyrlvyrlwvqko' ~ '(?:(?:((.))))((\2)\1.){0,0}?';
+server closed the connection unexpectedly
+ This probably means the server terminated abnormally
+ before or while processing the request.
+connection to server was lost

The assert itself dates back to a commit of yours from 2003. I don't think you did anything wrong here, but I wonder if you might understand the code better than anyone else?

The relevant bit of the stack trace is:

frame #3: 0x00000001020eff7d postgres`ExceptionalCondition(conditionName=<unavailable>, errorType=<unavailable>, fileName=<unavailable>, lineNumber=<unavailable>) at assert.c:69:2 [opt]
frame #4: 0x0000000101e2c682 postgres`delsub(nfa=0x00007fc7e8407360, lp=0x00007fc7e8831010, rp=0x00007fc7e8827328) at regc_nfa.c:1265:2 [opt]
frame #5: 0x0000000101e28dd8 postgres`parsebranch [inlined] parseqatom(v=<unavailable>, stopper=101, type=112, lp=<unavailable>, rp=0x00007fc7e8827328, top=<unavailable>) at regcomp.c:1084:3 [opt]
frame #6: 0x0000000101e27de9 postgres`parsebranch(v=0x00007ffeee0a80b8, stopper=101, type=<unavailable>, left=<unavailable>, right=<unavailable>, partial=<unavailable>) at regcomp.c:759 [opt]
frame #7: 0x0000000101e29719 postgres`parsebranch [inlined] parseqatom(v=<unavailable>, stopper=101, type=112, lp=<unavailable>, rp=0x00007fc7e8827328, top=<unavailable>) at regcomp.c:1282:23 [opt]
frame #8: 0x0000000101e29639 postgres`parsebranch(v=0x00007ffeee0a80b8, stopper=101, type=<unavailable>, left=<unavailable>, right=<unavailable>, partial=<unavailable>) at regcomp.c:759 [opt]
frame #9: 0x0000000101e2457b postgres`parse(v=0x00007ffeee0a80b8, stopper=101, type=112, init=0x00007fc7e8827280, final=0x00007fc7e88272b8) at regcomp.c:691:12 [opt]
frame #10: 0x0000000101e234d2 postgres`pg_regcomp(re=0x00007ffeee0a8208, string=<unavailable>, len=<unavailable>, flags=<unavailable>, collation=<unavailable>) at regcomp.c:418:12 [opt]
frame #11: 0x0000000101f75790 postgres`RE_compile_and_cache(text_re=<unavailable>, cflags=<unavailable>, collation=100) at regexp.c:186:19 [opt]
frame #12: 0x0000000101f75b90 postgres`textregexeq [inlined] RE_compile_and_execute(text_re=<unavailable>, dat=<unavailable>, dat_len=13, cflags=3, collation=<unavailable>, nmatch=0, pmatch=<unavailable>) at regexp.c:351:7 [opt]

[1] https://www.postgresql.org/message-id/2219936.1628115334%40sss.pgh.pa.us


Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-08-05 20:49:00 Re: Assert triggered during RE_compile_and_cache
Previous Message Andrew Dunstan 2021-08-05 20:19:03 Re: very long record lines in expanded psql output