Opened 6 years ago

Closed 6 years ago

#4036 closed defect (invalid)

OOM when PostGIS installed with pg_store_plans

Reported by: pramsey Owned by: pramsey
Priority: medium Milestone: PostGIS 2.4.4
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

From Kazuki Kariatsumari:

To the DB of the environment where pg_store_plans is enabled, attempting to enable PostGIS will result in OutOfMemory.

The steps that occurred are described below.

  1. Install PostGIS.
  2. Install pg_store_plans.
  3. Write pg_store_plans in shared_preload_libraries in postgresql.conf.
  4. Restart Postgresql.
  5. Connect to DB.
  6. Execute "CREATE EXTENSION postgis".

Change History (1)

comment:1 by pramsey, 6 years ago

Resolution: invalid
Status: assignedclosed

The backtrace during the OOM event indicates that the problem is actually in the pg_store_plans parser trying to handle the PostGIS extension script, not in PostGIS itself. Unfortunately the whole extension script seems to be fed into the pg_store_plans machinery, so it's well nigh impossible on our part to find out which bit it objects to. This issue should be sent to pg_store_plans, as "ability to handle whatever junk is passed to you on input" is an important feature of any extension.

  * frame #0: 0x000000010de38ef5 pg_store_plans.so`norm_yylex + 469
    frame #1: 0x000000010de3863b pg_store_plans.so`normalize_expr + 107
    frame #2: 0x000000010de37194 pg_store_plans.so`hash_query + 36
    frame #3: 0x000000010de3636b pg_store_plans.so`pgsp_ExecutorEnd + 475
    frame #4: 0x000000010ce64a77 postgres`ExecutorEnd(queryDesc=0x00007f8baa28f498) + 39 at execMain.c:464
    frame #5: 0x000000010cdd26bc postgres`execute_sql_string(sql="\n-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n--\n--\n-- PostGIS - Spatial Types for PostgreSQL\n-- http://postgis.net\n-- Copyright 2001-2003 Refractions Research Inc.\n--\n-- This is free software; you can redistribute and/or modify it under\n-- the terms of the GNU General Public Licence. See the COPYING file.\n--\n-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n--\n-- WARNING: Any change in this file must be evaluated for compatibility.\n--          Changes cleanly handled by postgis_upgrade.sql are fine,\n--\t    other changes will require a bump in Major version.\n--\t    Currently only function replaceble by CREATE OR REPLACE\n--\t    are cleanly handled.\n--\n-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n-- INSTALL VERSION: '2.5.0dev'\n\n\nSET LOCAL client_min_messages TO warning;\n\n-- Check that no other postgis is installed\nDO $$\nDECLARE\n  rec RECORD;\nBEGIN\n  FOR rec IN\n    SELECT n.nspname, p.prona"..., filename="/opt/pgsql/10/share/extension/postgis--2.5.0dev.sql") + 364 at extension.c:752
    frame #6: 0x000000010cdd1ac4 postgres`execute_extension_script(extensionOid=2255231, control=0x00007f8bca008ef0, from_version=0x0000000000000000, version="2.5.0dev", requiredSchemas=0x0000000000000000, schemaName="public", schemaOid=2200) + 1380 at extension.c:924
Note: See TracTickets for help on using tickets.