Re: Server closed the connection unexpectedly (memory leak) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Server closed the connection unexpectedly (memory leak)
Date
Msg-id 229225.1687625766@sss.pgh.pa.us
Whole thread Raw
In response to Server closed the connection unexpectedly (memory leak)  (Zu-Ming Jiang <zuming.jiang@inf.ethz.ch>)
Responses Re: Server closed the connection unexpectedly (memory leak)  (Andres Freund <andres@anarazel.de>)
List pgsql-bugs
Zu-Ming Jiang <zuming.jiang@inf.ethz.ch> writes:
> My fuzzer finds a bug in Postgres, which makes the connection closed 
> unexpectedly.

TBH, I think there's not much to be learned here, beyond "a
ridiculously complicated query takes a ridiculous amount of memory
to plan".  The reason for the backend crash is presumably that the
OOM killer decided to zap it.  If you run the postmaster under a
"ulimit -v" setting that's small enough to act before the OOM killer
does, then you get an unexciting "out of memory" error.

I did find that if you mark cte_3 as MATERIALIZED, the resource
consumption is a lot less --- but you get a plan that requires
41191 lines to EXPLAIN, so it's still way outside any bounds of
reasonability.  Perhaps there's room there to argue that we
shouldn't flatten CTE subqueries that are "too big" ... but it's
hard to decide how to measure "too big".

            regards, tom lane



pgsql-bugs by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: BUG #17949: Adding an index introduces serialisation anomalies.
Next
From: PG Bug reporting form
Date:
Subject: BUG #17995: Segmentation fault caused by UPDATE statement