psql leaks memory on query cancellation
Darafei Komяpa Praliaskouski <me@komzpa.net>
From: Darafei "Komяpa" Praliaskouski <me@komzpa.net>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-04-12T10:26:15Z
Lists: pgsql-hackers
Hi, psql (PostgreSQL) 10.3 Here are the steps to reproduce a leak: 1. connect to 10.3 server, perform the query similar to: select 'message' || generate_series(1,1000000000); 2. monitoring psql memory usage in htop or similar tool, press ctrl+c at some point where you can clearly distinguish a psql with a big allocated buffer from psql without it. 3. see the query cancelled, but psql memory usage stays the same. This is especially painful when query you're debugging has a runaway join condition, and you understand it only after it doesn't return in seconds as you've expected. Is it expected behavior (so I can have a look at something server returned somehow and it's kept there for me), or a plain leak? Darafei Praliaskouski, GIS Engineer / Juno Minsk
Commits
-
In libpq, free any partial query result before collecting a server error.
- bbec33c2d026 9.3.23 landed
- 3dd36aa4b36c 9.4.18 landed
- 2278e94ae941 9.5.13 landed
- 131f6a958360 9.6.9 landed
- d25c2ee9c038 11.0 landed
- d014b38df60f 10.4 landed