Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tYSNK-00Azdb-L0 for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Jan 2025 16:05:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tYSNJ-00FPGY-9l for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Jan 2025 16:05:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tYSNI-00FPDd-Vu for pgsql-hackers@lists.postgresql.org; Thu, 16 Jan 2025 16:05:41 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tYSNH-000jjN-36 for pgsql-hackers@lists.postgresql.org; Thu, 16 Jan 2025 16:05:40 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-436202dd7f6so11866605e9.0 for ; Thu, 16 Jan 2025 08:05:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737043538; x=1737648338; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=tFXsePYpDFyDXLrVd5IkAVtGaLPVIsw0ASrDAoeyjd4=; b=QGwgFpi5EfaAHfqbMvRJj6Yyiz1WmvUeDqWuu7uuAPTKnc+dTrPFrvn68Nq6NIqJSn oGnHONGhxWIcZ2jgheORJaVilL6WuYJ+0eE5ogHCr6LHoacXnu3NWrPqYC69j+ZGQmx/ 1DzHz9SPTysYjMRwOkzbxUlE8OADZug+NxOA2NLuA8Vsr3sGb0LldO/3e1k3GGEBrKAE eBqFUTAFoHkwaCbEfGeypK6BgwiSa54GQ14Ftr2v7V4D8K3Gea55WDCIHJn9Wyndcg4V ynnQfTKdGYDWTKgha17l7xEj5bdTZULXX3K3hxcsJlgXSsOTj5lXD3UURUDcdP5e0+xm 63oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737043538; x=1737648338; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tFXsePYpDFyDXLrVd5IkAVtGaLPVIsw0ASrDAoeyjd4=; b=iCDB2g3qRUEr+iwEu2PAY8IJjJJdLEscfuCR6ebRAscpSqul78NoLsWhYKydP58Rlm B5T9WF7pH6xXSfXkqJqpsGN0FeO/HVQztc2s+oHQ6mDOnmLmpWgdLD7sWkVMqFEtc9/4 mhFcIDm85TI6XaNy+DOI3LMBzW0/HZd6IYBrWeQpY32uV0moMnQzGuhBPmFNgLFH3yQu KUa/LQKNhmH6fgjMZzgRLru2i+jxAA7omB81U/MvuveATN4yUMRC37kgYJdnwU36gDWW O9CIggEwik/jBLjIjf6CDvJXxtDq04/OxH3ICp8hhfKdjTuL/2CBPX+MEVfDU2MOt1OW hbrQ== X-Forwarded-Encrypted: i=1; AJvYcCUqhveUzxg//AGxn19si9/jkDw0bwBxeo5iFWl2ryIdiCI/8mM0ae7J1DTCHSAxceQYvBRqqHuUpSmN5oJV@lists.postgresql.org X-Gm-Message-State: AOJu0YyXSs86yd12EC4pvZf3FqRK/fYhMtiyKN6HbZiA9XLbfRts9O1T eCMEnSAJ5zbTCo7fPMxf3w8xevDTX4+jioda5vZX6w7AzvPRfYdR X-Gm-Gg: ASbGncvqLsb1fAxBJjyNOjaix7YelI3t/GwhL4wr/FywhRZZDyV6NJcj6zpP3HUMU0+ HtTstuWc2hnt5IbW9LaWxIHMlGsbb0sRa/OL64S49ELueboaDlyW67Xq2d05SjjwUjNSTMdVj0j CFUFZ6Dp4dDKGBTf41OXpvJXOKlGVt4kkZyU6+cC3CJoxIGBSaGHr1u0tGudRjfoO9z3uYDhiAv J6e/6SZGjCLu9MrAhRrH0b+CFod94gFZZBjZVFQL9S/V2ADipnoEmrMQdg1hxyvZXrc+ukRuA2H wUz0csQ4CPldvy3I3YKbyHXW7n4UdRL6rBpvJlRo3E/uW8g6/v7S8pOzWPUlG90evgQ3elS3FBD lP42hH+I= X-Google-Smtp-Source: AGHT+IGLYAVj1cRxYWlhiaSV9cdGmmAHaDqpy0JcFMOnIxKza7bTBLkQlFj/5Y7zsnrrIDHgDon9Tg== X-Received: by 2002:a05:600c:3b0f:b0:434:fff1:1ade with SMTP id 5b1f17b1804b1-436e26be612mr299436005e9.13.1737043537418; Thu, 16 Jan 2025 08:05:37 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43890417a76sm3535805e9.16.2025.01.16.08.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 08:05:36 -0800 (PST) Date: Thu, 16 Jan 2025 16:05:35 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Nazir Bilal Yavuz , Alvaro Herrera , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org, Andres Freund Subject: Re: per backend I/O statistics Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Jan 16, 2025 at 06:48:58AM +0000, Bertrand Drouvot wrote: > Hi, > > On Thu, Jan 16, 2025 at 09:55:10AM +0900, Michael Paquier wrote: > > On Wed, Jan 15, 2025 at 05:20:57PM +0300, Nazir Bilal Yavuz wrote: > > > I think allowing only pgStatPendingContext to have > > > MemoryContextAllowInCriticalSection() is not enough. We need to allow > > > at least pgStatSharedRefContext as well to have > > > MemoryContextAllowInCriticalSection() as it can be allocated too. > > > > > > ''' > > > pgstat_prep_pending_entry() -> > > > pgstat_get_entry_ref() -> > > > pgstat_get_entry_ref_cached() -> > > > MemoryContextAlloc(pgStatSharedRefContext, sizeof(PgStat_EntryRef)) > > > ''' > > > > Yep, I was pretty sure that we have a bit more going on. Last time I > > began digging into the issue I was loading injection_points in > > shared_preload_libraries with stats enabled to see how much I could > > break, and this was one pattern once I've forced the pending part. I > > didn't get through the whole exercise. > > I'll look at it and come back with a proposal as part of [1]. I looked at it and shared the outcome in [1]. It looks like it's more complicated as we could also hit a failed assertion in MemoryContextCreate(), like: TRAP: failed Assert("CritSectionCount == 0"), File: "mcxt.c", Line: 1107, PID: 3295726 pg18/bin/postgres(ExceptionalCondition+0xbb)[0x59668bee1f6d] pg18/bin/postgres(MemoryContextCreate+0x46)[0x59668bf2a8fe] pg18/bin/postgres(AllocSetContextCreateInternal+0x1df)[0x59668bf1bb11] pg18/bin/postgres(pgstat_prep_pending_entry+0x86)[0x59668bcff8cc] pg18/bin/postgres(pgstat_prep_backend_pending+0x2b)[0x59668bd024a9] I propose that as of now we discuss the issue in [1] instead of here. [1]: https://www.postgresql.org/message-id/Z4ks4%2BwnAz8eEyX9%40ip-10-97-1-34.eu-west-3.compute.internal Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com