Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNo8u-0006FM-EV for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Oct 2020 02:16:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNo8r-0007ED-TR for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Oct 2020 02:16:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNo8r-0007Dc-Hu for pgsql-hackers@lists.postgresql.org; Thu, 01 Oct 2020 02:16:21 +0000 Received: from mail-io1-xd44.google.com ([2607:f8b0:4864:20::d44]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kNo8k-00041h-9R for pgsql-hackers@postgresql.org; Thu, 01 Oct 2020 02:16:20 +0000 Received: by mail-io1-xd44.google.com with SMTP id k6so4954107ior.2 for ; Wed, 30 Sep 2020 19:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=+WLR0UbJMKCd0FpmUhpr1mqy03/dRlcBPI9S4XY6huU=; b=zcufhF6r+QkuDsnJTnjZb8ALoJ8X0E2CUPL6wwM90srqgHaRYWo6EBNPeouqz+x6AF 1xu2Vz7nKYx8XrEoU/dpkWNsvJ5TQFvpzw82TG9HCwEFtnr0eH6OemQQGXTSkpWdof76 3e3y9xiHvPzefLp/dM0rjWD8OlGm4m2+4sp8lYXTiMqJsuuQSG+nGwUoVsUiHoayJ4lN LnEq0L008Ym3MAcjDKJy3+Gg4BD+N3b83/fjBh8vRhDYakW7E5t+eq+50ZFUcptGWugB g5WLUWz/fWp7y3IMjBXvke2+Pqn0Ighf9c/zjG65zC4+Z70SkeIIHQcVi55YT/uzMHBD xxEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=+WLR0UbJMKCd0FpmUhpr1mqy03/dRlcBPI9S4XY6huU=; b=QIrNXaUF8servvjrQZAtChPTumCsz6ReL3aPnJ1ks7FPa3YGsn0UyRS3IB6mZzHsJi DT0FR1XrVSLeMyeSLpq+67X+N7JVqbGBF9mrEZuyQ6A/sa+r9+n+IrW/zO+a+PMj3lAg SqGoVMRA5GfhBwWICEXWxYfOTPDEfZpkuyRWqvQif2eZuI1fH5w9ferxWHiBf5PeFw+b qIHR2R3b4UxklCstH8xsr3wVmy9aq8U5DhgssuPOrTzKc4W9AjHwEF/A3aPKezMSLqoT RuT0CquI5aYqgJ8gurYu8XXH4av8L6Dm4B2Hs21UWlXVmdNQ5xiFxj4o+fhxh3Ba5z0/ hlkQ== X-Gm-Message-State: AOAM5311XGBz6sll7qzIZ+56QGS3KthkX6jfyTIfbm8/pRjqJ14Ugd44 Yoc3+ta2oYD/PoJv/7vgcZbAsrYchi3IfA== X-Google-Smtp-Source: ABdhPJy9NoqT1m0g2XToodza3EKrmJEUoNMMYZYsVHu6M3TFEobuopmdhuelp4CrMJhMRAEFuWZc4w== X-Received: by 2002:a6b:f909:: with SMTP id j9mr3869989iog.184.1601518571955; Wed, 30 Sep 2020 19:16:11 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id t14sm2012807ilj.45.2020.09.30.19.16.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2020 19:16:11 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 264F0800B3F; Wed, 30 Sep 2020 21:16:10 -0500 (CDT) Date: Wed, 30 Sep 2020 21:16:10 -0500 From: Justin Pryzby To: pgsql-hackers@postgresql.org Cc: Andres Freund Subject: terminate called after throwing an instance of 'std::bad_alloc' Message-ID: <20201001021609.GC8476@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk A VM crashed which is now running PG13.0 on centos7: Sep 30 19:40:08 database7 abrt-hook-ccpp: Process 17905 (postgres) of user 26 killed by SIGABRT - dumping core Core was generated by `postgres: telsasoft ts 192.168.122.11(34608) SELECT '. Unfortunately, the filesystem wasn't large enough and the corefile is truncated. The first badness in our logfiles looks like this ; this is the very head of the logfile: |[pryzbyj@database7 ~]$ sudo gzip -dc /var/log/postgresql/crash-postgresql-2020-09-30_194000.log.gz |head |[sudo] password for pryzbyj: |terminate called after throwing an instance of 'std::bad_alloc' | what(): std::bad_alloc |< 2020-09-30 19:40:09.653 ADT >LOG: checkpoint starting: time |< 2020-09-30 19:40:17.002 ADT >LOG: checkpoint complete: wrote 74 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=7.331 s, sync=0.006 s, total=7.348 s; sync files=25, longest=0.002 s, average=0.000 s; distance=295 kB, estimate=4183 kB |< 2020-09-30 19:40:22.642 ADT >LOG: server process (PID 17905) was terminated by signal 6: Aborted |< 2020-09-30 19:40:22.642 ADT >DETAIL: Failed process was running: --BEGIN SQL | SELECT * FROM I was able to grep the filesystem to find what looks like the preceding logfile (which our script had immediately rotated in its attempt to be helpful). |< 2020-09-30 19:39:09.096 ADT >LOG: checkpoint starting: time |< 2020-09-30 19:39:12.640 ADT >LOG: checkpoint complete: wrote 35 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=3.523 s, sync=0.006 s, total=3.544 s; sync files=14, longest=0.002 s, average=0.000 s; distance=103 kB, estimate=4615 kB This seemed familiar, and I found it had happened 18 months ago on a different server: |terminate called after throwing an instance of 'std::bad_alloc' | what(): std::bad_alloc |< 2019-02-01 15:36:54.434 CST >LOG: server process (PID 13557) was terminated by signal 6: Aborted |< 2019-02-01 15:36:54.434 CST >DETAIL: Failed process was running: | SELECT *, '' as n | FROM a, b WHERE | a.id = b.id AND | b.c IS NOT NULL | ORDER BY b.c LIMIT 9 I have a log of pg_settings, which shows that this server ran v11.1 until 2019-02-14, when it was upgraded to v11.2. Since v11.2 included a fix for a bug I reported involving JIT and wide tables, I probably saw this crash and dismissed it, even though tables here named "a" and "b" have only ~30 columns combined. The query that crashed in 2019 is actually processing a small queue, and runs every 5sec. The query that crashed today is a "day" level query which runs every 15min, so it ran 70some times today with no issue. Our DBs use postgis, and today's crash JOINs to the table with geometry columns, but does not use them at all. But the 2019 doesn't even include the geometry table. I'm not sure if these are even the same crash, but if they are, I think it's maybe an JIT issue and not postgis (??) I've had JIT disabled since 2019, due to no performance benefit for us, but I've been re-enabling it during upgrades and transitions, and instead disabling jit_tuple_deforming (since this performs badly for columns with high attnum). So maybe this will recur before too long.