0

Got an error while running an application connected to a PostgreSQL DB (10.12). All the connections got disconnected, looking through the server logs, I found the below.

TopMemoryContext: 292488 total in 8 blocks; 133432 free (197 chunks); 159056 used
  TopTransactionContext: 8192 total in 1 blocks; 4936 free (0 chunks); 3256 used
    AfterTriggerEvents: 139432 total in 5 blocks; 9072 free (4 chunks); 130360 used
    SPI Exec: 75497472 total in 19 blocks; 7519440 free (0 chunks); 67978032 used
      ExecutorState: 333568 total in 4 blocks; 9936 free (7 chunks); 323632 used
        ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
        ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
        ExprContext: 32768 total in 3 blocks; 16792 free (6 chunks); 15976 used
    SPI Proc: 67100672 total in 17 blocks; 5309432 free (0 chunks); 61791240 used
      PLpgSQL private cast cache: 8192 total in 1 blocks; 1800 free (0 chunks); 6392 used
      ExecutorState: 8192 total in 1 blocks; 7400 free (0 chunks); 792 used
        ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
      PL/pgSQL inline code context: 12231440 total in 27 blocks; 1154576 free (5 chunks); 11076864 used
  pgstat TabStatusArray lookup hash table: 8192 total in 1 blocks; 760 free (0 chunks); 7432 used
  PLpgSQL cast info: 0 total in 0 blocks; 0 free (0 chunks); 0 used
    PLpgSQL cast cache: 8192 total in 1 blocks; 1800 free (0 chunks); 6392 used
  PL/pgSQL function context: 24576 total in 2 blocks; 14384 free (1 chunks); 10192 used
  Type information cache: 24472 total in 2 blocks; 2840 free (0 chunks); 21632 used
  TableSpace cache: 8192 total in 1 blocks; 2312 free (0 chunks); 5880 used
  Operator lookup cache: 24576 total in 2 blocks; 10976 free (5 chunks); 13600 used
  RI compare cache: 8192 total in 1 blocks; 2840 free (0 chunks); 5352 used
  RI query cache: 8192 total in 1 blocks; 760 free (0 chunks); 7432 used
  RI constraint cache: 40888 total in 2 blocks; 2840 free (0 chunks); 38048 used
  Sequence values: 8192 total in 1 blocks; 1800 free (0 chunks); 6392 used
  CFuncHash: 8192 total in 1 blocks; 776 free (0 chunks); 7416 used
  Rendezvous variable hash: 8192 total in 1 blocks; 776 free (0 chunks); 7416 used
  PLpgSQL function cache: 24528 total in 2 blocks; 2840 free (0 chunks); 21688 used
  MessageContext: 8064056 total in 3 blocks; 6704 free (4 chunks); 8057352 used
  Operator class cache: 8192 total in 1 blocks; 776 free (0 chunks); 7416 used
  smgr relation table: 122880 total in 4 blocks; 43376 free (14 chunks); 79504 used
  TransactionAbortContext: 32768 total in 1 blocks; 32728 free (0 chunks); 40 used
  Portal hash: 8192 total in 1 blocks; 776 free (0 chunks); 7416 used
  PortalMemory: 8192 total in 1 blocks; 7880 free (0 chunks); 312 used
    PortalHeapMemory: 1024 total in 1 blocks; 664 free (0 chunks); 360 used
  Relcache by OID: 24576 total in 2 blocks; 9840 free (4 chunks); 14736 used
  CacheMemoryContext: 1040384 total in 7 blocks; 283456 free (59 chunks); 756928 used
    CachedPlan: 33553408 total in 16 blocks; 2964016 free (0 chunks); 30589392 used
    CachedPlanSource: 52635896 total in 19 blocks; 3699808 free (0 chunks); 48936088 used
      CachedPlanQuery: 41942016 total in 17 blocks; 8263344 free (1 chunks); 33678672 used
    SPI Plan: 1024 total in 1 blocks; 824 free (0 chunks); 200 used
    CachedPlan: 7168 total in 3 blocks; 3368 free (0 chunks); 3800 used
    CachedPlan: 7168 total in 3 blocks; 3368 free (0 chunks); 3800 used
    CachedPlanSource: 3072 total in 2 blocks; 1704 free (0 chunks); 1368 used
      CachedPlanQuery: 3072 total in 2 blocks; 656 free (1 chunks); 2416 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlanSource: 3072 total in 2 blocks; 1704 free (0 chunks); 1368 used
      CachedPlanQuery: 3072 total in 2 blocks; 656 free (1 chunks); 2416 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    rm_o_resource_usage_instance_splits_new_activity_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_resource_usage_instance_splits_new_usage_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_resource_usage_instance_splits_new_solution_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_resource_usage_instance_splits_new_pkey: 3072 total in 2 blocks; 1976 free (0 chunks); 1096 used
    CachedPlan: 7168 total in 3 blocks; 3128 free (1 chunks); 4040 used
    CachedPlanSource: 3072 total in 2 blocks; 1736 free (0 chunks); 1336 used
      CachedPlanQuery: 3072 total in 2 blocks; 960 free (1 chunks); 2112 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    rm_o_plant_usage_instances_usage_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_plant_usage_instances_pkey: 3072 total in 2 blocks; 1976 free (0 chunks); 1096 used
    CachedPlan: 7168 total in 3 blocks; 3888 free (0 chunks); 3280 used
    CachedPlanSource: 3072 total in 2 blocks; 1736 free (0 chunks); 1336 used
      CachedPlanQuery: 3072 total in 2 blocks; 1176 free (1 chunks); 1896 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlan: 7168 total in 3 blocks; 3256 free (0 chunks); 3912 used
    CachedPlanSource: 3072 total in 2 blocks; 608 free (0 chunks); 2464 used
      CachedPlanQuery: 3072 total in 2 blocks; 728 free (1 chunks); 2344 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlan: 7168 total in 3 blocks; 3256 free (0 chunks); 3912 used
    CachedPlanSource: 3072 total in 2 blocks; 608 free (0 chunks); 2464 used
      CachedPlanQuery: 3072 total in 2 blocks; 728 free (1 chunks); 2344 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlan: 3072 total in 2 blocks; 368 free (0 chunks); 2704 used
    CachedPlan: 3072 total in 2 blocks; 360 free (0 chunks); 2712 used
    rm_o_top_schedules_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_top_schedules_pkey: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    CachedPlanSource: 3072 total in 2 blocks; 1736 free (0 chunks); 1336 used
      CachedPlanQuery: 3072 total in 2 blocks; 1184 free (1 chunks); 1888 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlanSource: 3072 total in 2 blocks; 1736 free (0 chunks); 1336 used
      CachedPlanQuery: 3072 total in 2 blocks; 1176 free (1 chunks); 1896 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlan: 7168 total in 3 blocks; 3784 free (0 chunks); 3384 used
    CachedPlanSource: 3072 total in 2 blocks; 608 free (0 chunks); 2464 used
      CachedPlanQuery: 3072 total in 2 blocks; 728 free (1 chunks); 2344 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    rm_o_plant_usage_solution_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_plant_usage_pkey: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_resource_usage_sched: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_resource_usage_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_resource_usage_pkey: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    CachedPlan: 7168 total in 3 blocks; 3584 free (0 chunks); 3584 used
    CachedPlanSource: 3072 total in 2 blocks; 1736 free (0 chunks); 1336 used
      CachedPlanQuery: 3072 total in 2 blocks; 872 free (1 chunks); 2200 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    rm_o_resource_instance_usage_pkey: 3072 total in 2 blocks; 1976 free (0 chunks); 1096 used
    rm_o_resource_instance_usage_sched: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    CachedPlan: 7168 total in 3 blocks; 1600 free (0 chunks); 5568 used
    CachedPlan: 7168 total in 3 blocks; 1720 free (0 chunks); 5448 used
    CachedPlan: 7168 total in 3 blocks; 1720 free (0 chunks); 5448 used
    CachedPlan: 7168 total in 3 blocks; 1720 free (0 chunks); 5448 used
    CachedPlanSource: 3072 total in 2 blocks; 608 free (0 chunks); 2464 used
      CachedPlanQuery: 7168 total in 3 blocks; 3248 free (2 chunks); 3920 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlanSource: 3072 total in 2 blocks; 608 free (0 chunks); 2464 used
      CachedPlanQuery: 7168 total in 3 blocks; 3248 free (2 chunks); 3920 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlan: 7168 total in 3 blocks; 1720 free (0 chunks); 5448 used
    CachedPlanSource: 3072 total in 2 blocks; 608 free (0 chunks); 2464 used
      CachedPlanQuery: 7168 total in 3 blocks; 3248 free (2 chunks); 3920 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    rm_o_schedule_stats_id_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_schedule_stats_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_schedule_stats_pkey: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    CachedPlanSource: 3072 total in 2 blocks; 608 free (0 chunks); 2464 used
      CachedPlanQuery: 7168 total in 3 blocks; 3248 free (2 chunks); 3920 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    CachedPlan: 7168 total in 3 blocks; 3544 free (0 chunks); 3624 used
    rm_o_dependencymap_pkey: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    CachedPlan: 3072 total in 2 blocks; 384 free (0 chunks); 2688 used
    rm_o_top_resets_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    rm_o_top_resets_pkey: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    CachedPlanSource: 3072 total in 2 blocks; 1752 free (0 chunks); 1320 used
      CachedPlanQuery: 3072 total in 2 blocks; 1200 free (1 chunks); 1872 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    rm_o_reset_stats_pkey: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    CachedPlan: 7168 total in 3 blocks; 2688 free (0 chunks); 4480 used
    CachedPlanSource: 3072 total in 2 blocks; 1736 free (0 chunks); 1336 used
      CachedPlanQuery: 7168 total in 3 blocks; 4032 free (1 chunks); 3136 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    scheduleactivities_solution_activity_idx: 1024 total in 1 blocks; 264 free (0 chunks); 760 used
    scheduledactivities_activity_index_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    scheduled_activities_activity_id_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    scheduled_activities_id_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    scheduled_activities_idx: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    scheduled_activities_pkey: 1024 total in 1 blocks; 400 free (0 chunks); 624 used
    CachedPlan: 7168 total in 3 blocks; 3440 free (1 chunks); 3728 used
    CachedPlan: 7168 total in 3 blocks; 3176 free (1 chunks); 3992 used
    CachedPlan: 7168 total in 3 blocks; 3240 free (1 chunks); 3928 used
    CachedPlan: 7168 total in 3 blocks; 2824 free (1 chunks); 4344 used
    CachedPlan: 7168 total in 3 blocks; 3704 free (0 chunks); 3464 used
    CachedPlan: 7168 total in 3 blocks; 3800 free (0 chunks); 3368 used
    CachedPlan: 3072 total in 2 blocks; 328 free (0 chunks); 2744 used
    CachedPlan: 7168 total in 3 blocks; 3256 free (1 chunks); 3912 used
    CachedPlan: 3072 total in 2 blocks; 360 free (0 chunks); 2712 used
    CachedPlan: 3072 total in 2 blocks; 424 free (0 chunks); 2648 used
    CachedPlan: 7168 total in 3 blocks; 3344 free (1 chunks); 3824 used
    CachedPlan: 7168 total in 3 blocks; 3784 free (0 chunks); 3384 used
    CachedPlan: 3072 total in 2 blocks; 48 free (0 chunks); 3024 used
    CachedPlan: 7168 total in 3 blocks; 3168 free (1 chunks); 4000 used
    CachedPlan: 7168 total in 3 blocks; 3720 free (0 chunks); 3448 used
    pg_toast_34016_index: 1024 total in 1 blocks; 264 free (0 chunks); 760 used
    CachedPlan: 7168 total in 3 blocks; 2824 free (1 chunks); 4344 used
    CachedPlanSource: 3072 total in 2 blocks; 1704 free (0 chunks); 1368 used
      CachedPlanQuery: 3072 total in 2 blocks; 656 free (1 chunks); 2416 used
    SPI Plan: 1024 total in 1 blocks; 800 free (0 chunks); 224 used
    157 more child contexts containing 295936 total in 229 blocks; 128080 free (21 chunks); 167856 used
  WAL record construction: 49768 total in 2 blocks; 6584 free (0 chunks); 43184 used
  PrivateRefCount: 8192 total in 1 blocks; 2840 free (0 chunks); 5352 used
  MdSmgr: 24576 total in 2 blocks; 19240 free (457 chunks); 5336 used
  LOCALLOCK hash: 24576 total in 2 blocks; 8896 free (4 chunks); 15680 used
  Timezones: 104120 total in 2 blocks; 2840 free (0 chunks); 101280 used
  ErrorContext: 8192 total in 1 blocks; 5928 free (0 chunks); 2264 used
Grand total: 294208176 bytes in 634 blocks; 29864952 free (819 chunks); 264343224 used
2020-04-26 02:51:12.468 EDT [13848] PANIC:  out of memory
2020-04-26 02:51:12.468 EDT [13848] DETAIL:  Failed on request of size 4194304.
2020-04-26 02:51:27.528 EDT [5184] LOG:  server process (PID 13848) was terminated by exception 0xC0000409

The machine itself has 16GB, and at the time, only 8GB was being used, so the machine itself has sufficient memory. The error code referenced (0xC0000409), I believe, relates to running out of stack memory? The query being done is extremely long, as its inserting tens of thousands of entries into multiple tables.

Any help resolving this error would be greatly appreciated.

EDIT: postgresql.conf:

listen_addresses = '*'      
port = 5432
max_connections = 100

shared_buffers = 128MB          

maintenance_work_mem = 64MB

dynamic_shared_memory_type = windows    

max_logical_replication_workers = 4

log_destination = 'csvlog'      

logging_collector = on      

log_timezone = 'US/Eastern'

datestyle = 'iso, ymd'

timezone = 'US/Eastern'

lc_messages = 'English_Canada.1252'
lc_monetary = 'English_Canada.1252'
lc_numeric = 'English_Canada.1252'
lc_time = 'English_Canada.1252'

default_text_search_config = 'pg_catalog.english'
3
  • can you share postgresql.conf configurations – Shiwangini Shishulkar Apr 28 '20 at 11:43
  • @ShiwanginiShishulkar, I've included the non-commented lines from the config file. Should be more or less default. – ChrisMM Apr 28 '20 at 11:51
  • You probably get better answers if you ask that on the Postgres mailing list – a_horse_with_no_name Apr 28 '20 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.