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 1ujfh0-00AZ9Y-Jc for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Aug 2025 15:04: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 1ujfgz-00Gb3g-AA for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Aug 2025 15:04:37 +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 1ujfgy-00Gb3X-W8 for pgsql-hackers@lists.postgresql.org; Wed, 06 Aug 2025 15:04:37 +0000 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ujfgw-0013i0-1d for pgsql-hackers@lists.postgresql.org; Wed, 06 Aug 2025 15:04:36 +0000 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-30687111693so8481fac.0 for ; Wed, 06 Aug 2025 08:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754492675; x=1755097475; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XwAGk9ptRLA+6EykAGH5t5aaVa7gKMTEvZRFxZwL0Ko=; b=kBfyplRXZXGLNDCmpPS0Mk38L1q5I26Dy8CtoojHjIIYmn9AlGAvZ7wLB4wuXqsh+/ AikpztvZ8HtlPLStJLfpazNH4FoxNkmYvbDtT0UK3Y3aLiArZwFn5yyPDNuHA9BnNxlm aL+fvYQXGek9HeajdWtOsG7cvCxIx5tuK4czdBmDibsZC4czDjc0MSIjUK9RjBDdacHa 9ZTNDmKEb1aGmX2E1w0rdMJ4BigT1sZYs9qdrAih3/hUxIqlc94aedu1NYTP5IbJ8/CA HYjqpip1aDArm9G+gdfXE7B7/bmDyfbDQQAydUDAGaq0fVjr2qQskGrDWVCrK1gfOzQm /ZCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754492675; x=1755097475; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XwAGk9ptRLA+6EykAGH5t5aaVa7gKMTEvZRFxZwL0Ko=; b=KHAuhchy7PNMpGtteAAqiiu4gZ45Arco3q0BbZ6sE+nGrhTr3brqcoShgE0S0mkZmt kWjlxJjiy7dPp12n3VbcaqabtMpCofg+n8qTHaGH8/k6FUxSdukdimlUbCwUke2F+Li0 jkilTjFCF3eSJiNAEXPQDwUm8Atar3zzOTgSlhh09eOxNktvgpaUdFAUIWo5ckN/DTMc NSbnkyAx2B2JT3ZLmCj90s+ip9rPR17SG5mXkXgnjeL+hXenZYopKzn3K8y2MbYO7F3G 4aRWce0m6WN7YgzfMUiLx1PLHrxIBPQsb7R2KRa+s6Pd3jwzLyGhsq11/sP6RDuTD1bc dv5g== X-Gm-Message-State: AOJu0YwhwNPFTC5tPLaKLxC6bztg1LQ82xjtYjyNS4d/UvHoq8zWuG/P 4/qvUC2RL0MIkwpJrNnKo8WS1z//fj2gQEqy9q2AYlJ25ATyhaXrRBBGB8CoA4wgCchR4VOAhB0 3GXQM/5RRaaw/l4js6Bgcg6uJSzFwt78= X-Gm-Gg: ASbGncvsBCnMDPz0dzlluSMnaLQdZjquYADViqSm4YmRfVi3L6l4Trxwv8JCJHjeTot l8JGD+PTeA+SoiKsWY0xJl7yfUWql9kgW67rYj8Zh7dmhvUP+xgtGg+VRW5QfoCai/n3r3u7qVT Ks+w2U2JhqnuFakMzKeqmvqpDnMjntDGRlnDEDCoW8rv2CbQS9DDZ1TgSFU3L1sjPIXV+gtUDs4 Zsl83l+MFjMZbWU1wwHofow4fPkP6GS0hqPrvU4 X-Google-Smtp-Source: AGHT+IGOXf7J6mtXbbQEoThzHhLvijzIvk46UwQjONKI4hX7vXK+A72cy1pMUp+Bbf3lgVPiKvBw59RgLku9iNlt4+A= X-Received: by 2002:a05:687c:2c68:b0:30b:6ce8:a307 with SMTP id 586e51a60fabf-30be2981c9amr794058fac.4.1754492674663; Wed, 06 Aug 2025 08:04:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Thomas Munro Date: Thu, 7 Aug 2025 03:03:57 +1200 X-Gm-Features: Ac12FXwtDLvTBvVq_Jrgd1ZNIytPeWHh8j7V7Pb43yqY3e6BrA0TbM-XbRuUAAo Message-ID: Subject: Re: [PATCH] OAuth: fix performance bug with stuck multiplexer events To: Jacob Champion Cc: PostgreSQL Hackers , Daniel Gustafsson , Peter Eisentraut Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Aug 5, 2025 at 3:24=E2=80=AFAM Jacob Champion wrote: > On Mon, Aug 4, 2025 at 7:53=E2=80=AFAM Thomas Munro wrote: > > [FYI, I'm looking into this and planning to post a review in 1-2 days..= .] 0001: So, the problem is that poll(kqueue_fd) reports POLLIN if any events are queued, but level-triggered events are only rechecked and possibly cancelled if you actually call kevent(). Hmm, what if you just called kevent() with an output array of size one? * If it returns 0, that means it has rechecked all queued level-triggered events and booted them all out because they are no longer true. poll(fd) won't report POLLIN until one of them is queued again. * If it returns 1, then it stopped on the first level-triggered event that it rechecked and found to be still true. Who cares if there are more that didn't get rechecked? poll(fd) will report POLLIN either way, and that's what you want.