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 1qWEXw-002YV0-EV for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Aug 2023 11:18:40 +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 1qWEXv-006AvF-1i for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Aug 2023 11:18:39 +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 1qWEXu-006Av7-J3 for pgsql-hackers@lists.postgresql.org; Wed, 16 Aug 2023 11:18:38 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qWEXr-000Shu-6u for pgsql-hackers@lists.postgresql.org; Wed, 16 Aug 2023 11:18:38 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-319e93a1594so590465f8f.1 for ; Wed, 16 Aug 2023 04:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1692184714; x=1692789514; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aOkoikLn7KFePe3NpRW1k45scMlXWTYx/l/HKJM1uHU=; b=ox+6enKuNYyLOBErv6GdWXJHV0ZsP8KG87KtDaWxKUWvvKAopG7MhMg8lWmTR0TJGc iTZ7SlpmAh+qivJepn0CbreUn/O8/SwuzBW3r96FlMIhni38YFrFSut3GCfHHEJFIOqH cLhwzP0jvqJNbhBENP7hB8nBv9kbkAQX26vfHB4oxftt5mpcfX604WFLtoC2aRolCFqf XTnrjkQA9OeA5/JbvQHHIfWHHqaggUKjHa/6wq+M7JXdFq6nJ8L+jTqXTDhfwB0Ce9Pk vTlEgnT72BlP1LU05qIqqD4HCAgmtQxqcRJ5rtLw7fEWByocZPhUjZEo+2xPVTq9BBq4 Q0qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692184714; x=1692789514; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aOkoikLn7KFePe3NpRW1k45scMlXWTYx/l/HKJM1uHU=; b=Svd9Xu2SEPQT5xravGttNMEcs/w7rnNvF49ickL3C76ivBvOovqlmfXek4skiC+WMz 0haoMmvX1yaLRuEBFVFQ6GdkLpoSZbIrFXVTo9wrxfLK3SQ1mnQ4Py6UJ40bh2bganrS 1+lHGTkTr9VHznT0yX0ZPZWIW0GJ9zRBYJwXuKaop9v1P9OgTcxzzalp7CcsR+jZcTJK 7+OvoNJJ/yJmh+94IMgWBgxFxuTgk0j3d2m7HNHPuClH951kTfzM4itMaUAZkkHzly+L dz0qRJ9ssf5/SYg+Hik8gTd+HBbwXHId61bU8zA6Nc1HAdlIlRHd8rMPSYpMIcrJxRTZ IOYg== X-Gm-Message-State: AOJu0YxD5yzyPuHdwdO0etXgYiHUO3QOi5dQUjPukzNADdcfZp87ypS/ xUCix8DGtI36wbBERFXVEotbgw== X-Google-Smtp-Source: AGHT+IFbe8Fmu3jJmcWSwgoha4mu7yD1zC3lJ1CGZZAe85fUJA1bQ98ghJTTVDYV+DWTIT6E2z131Q== X-Received: by 2002:adf:fec2:0:b0:317:57f0:fae with SMTP id q2-20020adffec2000000b0031757f00faemr1477007wrs.63.1692184714053; Wed, 16 Aug 2023 04:18:34 -0700 (PDT) Received: from antos ([88.103.134.59]) by smtp.gmail.com with ESMTPSA id j2-20020adfff82000000b003195504c754sm19335821wrr.31.2023.08.16.04.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 04:18:33 -0700 (PDT) From: Antonin Houska To: Thomas Munro cc: Tomas Vondra , Andres Freund , PostgreSQL Hackers Subject: Re: walsender "wakeup storm" on PG16, likely because of bc971f4025c (Optimize walsender wake up logic using condition variables) In-reply-to: References: <2840876b-4cfe-240f-0a7e-29ffd66711e7@enterprisedb.com> <20230811175111.3h7pwmezbvoglb5t@awork3.anarazel.de> <977682d0-a23e-9529-ccc6-8872769c0f6e@enterprisedb.com> Comments: In-reply-to Thomas Munro message dated "Tue, 15 Aug 2023 10:55:12 +1200." X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 28.2.50 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 16 Aug 2023 13:20:23 +0200 Message-ID: <3029.1692184823@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro wrote: > On Tue, Aug 15, 2023 at 2:23=E2=80=AFAM Tomas Vondra > wrote: > > I'm not familiar with the condition variable code enough to have an > > opinion, but the patch seems to resolve the issue for me - I can no > > longer reproduce the high CPU usage. >=20 > Thanks, pushed. I try to understand this patch (commit 5ffb7c7750) because I use condition variable in an extension. One particular problem occured to me, please consider: ConditionVariableSleep() gets interrupted, so AbortTransaction() calls ConditionVariableCancelSleep(), but the signal was sent in between. Shouldn= 't at least AbortTransaction() and AbortSubTransaction() check the return value of ConditionVariableCancelSleep(), and re-send the signal if needed? Note that I'm just thinking about such a problem, did not try to reproduce = it. --=20 Antonin Houska Web: https://www.cybertec-postgresql.com