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 1lYjP2-0007ck-5d for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Apr 2021 05:58:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lYjP0-0002kZ-C8 for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Apr 2021 05:58:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYjP0-0002kE-5C for pgsql-hackers@lists.postgresql.org; Tue, 20 Apr 2021 05:58:26 +0000 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lYjOx-0002vj-Hk for pgsql-hackers@postgresql.org; Tue, 20 Apr 2021 05:58:24 +0000 Received: by mail-oi1-x233.google.com with SMTP id r186so10097919oif.8 for ; Mon, 19 Apr 2021 22:58:23 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=96akFcSKE8QEaGFzj/ooLLXcPRxP8LTQ9o9ssmKbnWk=; b=fMIJRlBsjrcuXr1gpJWzKdDOUFqXApZkjkErAhqhRM45NrmnurH64ZNspA5WSt6vvG ftqZW6eKW3E0c1cdMn8PURRRdTZy9q/1krR3hYRXcDMfaW0aTSu9GZowkJ7Hf25UC/dR OtgJQrJx08m6T1MZWy4yMP0f1I5XdlevnWpKbZEhLVGsVza1cu7GJWRIjWqAVcYH5nBK P1g/KRcCmquAc17QUdITF54LqjwU0PVSfIrVHRhVyxrnCZSEuJ7WBDe9xMUvCZ0z6SvV kALXSs5wfmX7biqsVjcWZVTkmTXqCkZVBxOIK2wvGdaA188KgmQaIonoS2GzhPwgd0I7 wLdg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=96akFcSKE8QEaGFzj/ooLLXcPRxP8LTQ9o9ssmKbnWk=; b=rjWId1YfnDCECgnlOJB1/GK74qPCELAbVa5uvDvRRK4UpbyssGVLKkT4qelGPsx9J1 +PQm5UXo3Mh6MgN0raFhl2XwMxtOvZbpudZKVs2dl6v1yd6b2l0eMtvTzjda6c+aKyIf UvVHe8zdUSk5AIEcbkWiSwgPcARYPyPA2BJGvvdhX+XmOnoRl85SIbaW2t9+3QKBW+VN kl23FE1JRvaxjJJsuWeXvB0oMTwQlmjPFvcZEAmM0Acnf2Eyj8c/M+aNC088iqeUxffo UEAzwbyctsJwuLFwaukU+WgzA58732kjD6MSQ65PAnRJCncvK/JP587/YVqt920CCc/9 Uhdw== X-Gm-Message-State: AOAM532diV6zn1n5JSusFOQpntDye8LsK+n8m9DeWj/ofQYcitk07CyL dC6MOEVGS2ilU/MB7OaE4xlP5g== X-Google-Smtp-Source: ABdhPJweEydc4if0z/vPrjmQBh1s3LeGH8ACDKrBWYuoTn1oNqupZ250zQG1BFN96RLXdV2oIdrjPg== X-Received: by 2002:aca:ea8b:: with SMTP id i133mr1861280oih.37.1618898302875; Mon, 19 Apr 2021 22:58:22 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id w29sm3910307ott.24.2021.04.19.22.58.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Apr 2021 22:58:22 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 3A9D9800BC5; Tue, 20 Apr 2021 00:58:21 -0500 (CDT) Date: Tue, 20 Apr 2021 00:58:21 -0500 From: Justin Pryzby To: Andres Freund Cc: pgsql-hackers@postgresql.org, Tom Lane Subject: Re: terminate called after throwing an instance of 'std::bad_alloc' Message-ID: <20210420055821.GA17201@telsasoft.com> References: <20201003233045.GM8476@telsasoft.com> <20201004020127.zbrol2ypu6tg2bei@alap3.anarazel.de> <20201007230242.rnwsbnxywvthef3w@alap3.anarazel.de> <20201218235607.GC30237@telsasoft.com> <20210417021755.xdcqaqqt4y46wzt7@alap3.anarazel.de> <20210417024854.GL3315@telsasoft.com> <20210417031837.GM3315@telsasoft.com> <20210418001324.GP3315@telsasoft.com> <20210419164130.byegpfrw46mzagcu@alap3.anarazel.de> <20210420053826.GM7256@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210420053826.GM7256@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Apr 20, 2021 at 12:38:26AM -0500, Justin Pryzby wrote: > I don't know if this is related to the other issues, but this seems leaky. And it explains how the context use counter can exceed its threshold. create or replace function fn() returns void language plpgsql as $$ declare rec int; begin SELECT relpages INTO rec FROM pg_class LIMIT 1; end $$; explain analyze SELECT fn() FROM generate_series(1,99); SELECT SUM(a) FROM (VALUES(1))a(a); time PGOPTIONS='-cclient_min_messages=debug -clog_executor_stats=off -clog_min_duration_statement=-1 -cjit=on -cjit_above_cost=0 -cjit_inline_above_cost=0' psql ts -f jitleak.sql ... psql:jitleak.sql:6: DEBUG: recreating LLVM context after 100 uses Question: does the jit context need to be recreated only when inlining is enabled? Or maybe it's better if it's not conditionalized like that..