From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by sourceware.org (Postfix) with ESMTPS id 3FD6F3858436 for ; Fri, 28 Apr 2023 15:33:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FD6F3858436 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-54f9b37c634so123723767b3.2 for ; Fri, 28 Apr 2023 08:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682696035; x=1685288035; 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=vkIXJOKBW3JTrgv8T9NlEcp+6LZ/AP6PYBv3JGv9Ovw=; b=nunXZhICl8Wi2B5miI3dym9wFmLQrxP/HmTli7Fs/7RYsiyPO5rZSVrmo6CpIB/hIF Qyga+uaLrJcEp/OnJkv5NpCguvfqXAkI0AJhaqSE6R4UDYfwcQZBlxeSyX196iWby77J 8EHvW8KZSWjdKmXD+PqxRez1A6PWl6n6ZXosfLtldWOPTKE5ljzx7Gs5nDNqQa11rYV3 zFWDNUa20Vp1zYBnMbTHSi55Tm89LTu7nqB4UhPr8+R7hukgcmJkLJL2JesJsP3UgOl6 zTp4fuH3A0+WGOVS26M4DD9lMNi6nhGyVP5loq5puuaeSL/yfySTirszZdMXeSlBqzTT 9SJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682696035; x=1685288035; 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=vkIXJOKBW3JTrgv8T9NlEcp+6LZ/AP6PYBv3JGv9Ovw=; b=SQWnzuxjci+J2vwWsazYDWspgGXEC9WJkv1410wL6zPTEEKwzidtW27hqbR5XHELLu uhBRIOUwUMW31vwHiihE0Zv9kPf5leGQLU0Vag8knkKUZAXPgDrhv2KQbisrRnImQbTR yjGijDo/KZD+N8HX0EMiCIRPUb0Q56/UcvFYiqn60cY0+YpVSakljJA3Hj1ISgMs7EB5 +38MHV1uQttYHpZLVh3vRK/Dks4v2eLKW5XfslCMk0vMrUfI5WKXJCfZXHaNAX2nMnH2 tyJ6k14MDlpeHoYMgCoTUoUMZC9rl/B9SXJR+R0d12j8X2o7NA1gdoLk3Ovgi8ld2LPS MdDQ== X-Gm-Message-State: AC+VfDwovDjxoOF1eBgOGBzt7V2i6O+nNkd7tuEJgqmy6pqhWwNFcT1D Y2xrjrILGTNKhdlRetynOrcl9K5KGGEr+6Aw31M= X-Google-Smtp-Source: ACHHUZ5Hql2b7BpkQM7simai/YlCWoglnay2/+ZmlfGIQzRyjOKwQ/jd+NaZ+VD5OxsTdctl3AIQW44lKoAAgTvWW2w= X-Received: by 2002:a81:8787:0:b0:555:cee3:d143 with SMTP id x129-20020a818787000000b00555cee3d143mr3878116ywf.4.1682696035645; Fri, 28 Apr 2023 08:33:55 -0700 (PDT) MIME-Version: 1.0 References: <20230427200615.1496059-1-hjl.tools@gmail.com> <87sfck9zas.fsf@oldenburg.str.redhat.com> In-Reply-To: <87sfck9zas.fsf@oldenburg.str.redhat.com> From: "H.J. Lu" Date: Fri, 28 Apr 2023 08:33:19 -0700 Message-ID: Subject: Re: [PATCH] __check_pf: Add a cancellation cleanup handler [BZ #20975] To: Florian Weimer Cc: "H.J. Lu via Libc-alpha" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3016.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Apr 28, 2023 at 1:38=E2=80=AFAM Florian Weimer = wrote: > > * H. J. Lu via Libc-alpha: > > > There are reports for hang in __check_pf: > > > > https://github.com/JoeDog/siege/issues/4 > > > > It is reproducible only under specific configurations: > > > > 1. Large number of cores (>=3D 64) and large number of threads (> 3X of > > the number of cores) with long lived socket connection. > > 2. Low power (frequency) mode. > > 3. Power management is enabled. > > > > While holding lock, __check_pf calls make_request which calls __sendto > > and __recvmsg. Since __sendto and __recvmsg are cancellation points, > > lock held by __check_pf won't be released and can cause deadlock when > > thread cancellation happens in __sendto or __recvmsg. Add a cancellati= on > > cleanup handler for __check_pf to unlock the lock when cancelled by > > another thread. This fixes BZ #20975 and the siege hang issue. > > It's probably easier to reproduce if the system has many network > interfaces with lots of addresses. > > Doesn't getaddrinfo leak all kind of resources when canceled? That's > more difficult to fix, though. We will work on it if there are reports. --=20 H.J.