Unfortunately, contrib/jsonb_plpython still contain a lot of problems in error
handling that can lead to memory leaks:- not all Python function calls are checked for the success- not in all places PG exceptions are caught to release Python references
But it seems that this errors can happen only in OOM case.
Attached patch with the fix. Back-patch for PG11 is needed.
--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company