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 1u9HnB-0006FQ-PP for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2025 06:16:38 +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 1u9Hn9-00CDA5-RQ for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2025 06:16:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9Hn9-00CD9x-HV for pgsql-hackers@lists.postgresql.org; Mon, 28 Apr 2025 06:16:36 +0000 Received: from forwardcorp1d.mail.yandex.net ([178.154.239.200]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u9Hn6-002RX8-2n for pgsql-hackers@postgresql.org; Mon, 28 Apr 2025 06:16:36 +0000 Received: from mail-nwsmtp-smtp-corp-main-68.klg.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-68.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:921:0:640:f23d:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id B688860A56 for ; Mon, 28 Apr 2025 09:16:31 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6b8:b081:b730::1:9]) by mail-nwsmtp-smtp-corp-main-68.klg.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id UGNnlp2FhOs0-FdWrTSjI; Mon, 28 Apr 2025 09:16:31 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1745820991; bh=l4mgmBsqJbfwNHvYeYA2ueE+r69PTdMevWDRvAPzKeQ=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=rjQjoWnzdPehJr3ONF+W8MuUzs0qTb+9YGvpAQtHrZZ6qa4WnFN9RYxsdrECKSUNz kuW58YraBqbFnPMbEIlp7vrK8RD/pcqBZmN1kJ6xFFY4pbGfa/TZdo0ghb0wpHGVfA cYp8C2FIoDJutrj0PWu4SlbgkHBvdFwzxjI4/Tz4= Authentication-Results: mail-nwsmtp-smtp-corp-main-68.klg.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Re: Cancel problems of query to pg_stat_statements From: Andrey Borodin In-Reply-To: <31431745515032@mail.yandex-team.ru> Date: Mon, 28 Apr 2025 11:16:19 +0500 Cc: "pgsql-hackers@postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <26A1F7AF-810A-4D60-A6CB-8B749BCCE747@yandex-team.ru> References: <31431745515032@mail.yandex-team.ru> To: Roman Khapov X-Mailer: Apple Mail (2.3776.700.51.11.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 24 Apr 2025, at 22:49, Roman Khapov wrote: >=20 > Hi! > Recently we faced a problem in out production psql installation, = which was that we had to cancel all requests to the db, including = performance monitoring requests, that uses ps_stat_statements. But we = could not cancel the request in usual way, and had to kill -9 the pg = process of it. Interesting problem, thanks for raising it! > We've noticed that the the query execution stuck on PGSS_TEXT_FILE = file reading in function qtext_load_file, which doesn't have = CHECK_FOR_INTERRUPTS in the read cycle. In addition to our case with = large PGSS_TEXT_FILE (and maybe the problems with virtual disk i/o) that = can explain uncancellable pg_stat_statements queries. I'm afraid it might be not so easy to add CHECK_FOR_INTERRUPTS there. = Most probably you was holding a LWLockAcquire(pgss->lock, LW_SHARED) = somewhere (do you have a backtrace?), which prevent interrupts anyway. Thanks! Best regards, Andrey Borodin.=