From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 667653AE6E9 for ; Wed, 8 Jul 2026 19:58:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.146 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783540731; cv=none; b=WqjIkDUzmdkX9m+Fm2RUuMaBXe1yRoPh1VKwOokNsvFfZV5gNHBmOXI30nwmrnE2dT8sIx2tyKyaRYE9UFSUomP9RHNRahfa+Z18XeJKntyPy/ivmDLGsK8mgk14zNH5Qx+camweAmeeFic0+6U8RHwXKGVHzgDZfRKREIk0rRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783540731; c=relaxed/simple; bh=UjFaZyvYs8qRgX/M8LKij+9O1ocOoeJSjOTxoE02xw8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=k3CZb7ci+z6pZvf/YGmJt86zx0mdQHgDQuI3wh2TrGVSRvfOCh//GvjQg+5kYO0Cc6vCpmafaB1c8wlsNs/h16VlkOU2X4wcWT7K7XJSLnM832aiCyZkc82aEoUZVrpJuz0w3AwqUfFEY9Wa9yLW6oSLa7BmV25kPX0zfo/i0sg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=m4oD2PZD; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=im4aIKOx; arc=none smtp.client-ip=202.12.124.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="m4oD2PZD"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="im4aIKOx" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.stl.internal (Postfix) with ESMTP id A6A9B1D00116; Wed, 8 Jul 2026 15:58:49 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-07.internal (MEProxy); Wed, 08 Jul 2026 15:58:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1783540729; x=1783627129; bh=vyEbErQGoU nPP91VhwPfgAbcxCQaJARA4AHLPIIWwk0=; b=m4oD2PZDgwbFJSzNgueJbvCQcV b6G58hNfavdIjT+4DCGZl6IhBn4moaudOB/mf5XYlnTxF+kCkara1l05Gdo2gtiO v7J82zC9kSWxk5Xf/qJ9oRfXzJWH29epy9o7iJfIez249wGgo1duFTKZG8vz9uqp msxHHht34ew0wEUnlCqW2K2lQU7u5JSUys9Ch5bEENyloMl+IkbwMkLtsd+w4IpP KYVhXbWsS7rslT5TgczCYXLNCQcKZ0fHEuvJyCbS1o26TXWRNWLXey5F7UQdCmUD b2gDktRVHDt8t0wWrBId4HVyoTVWAL6bN5ZvleFXf5uguB81fh7lRo7hj4FQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1783540729; x=1783627129; bh=vyEbErQGoUnPP91VhwPfgAbcxCQaJARA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/w X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Jul 2026 15:58:49 -0400 (EDT) From: Junio C Hamano To: "Michael Montalbo via GitGitGadget" Cc: git@vger.kernel.org, Michael Montalbo Subject: Re: [PATCH 2/3] t/lib-httpd: make http-429 first-request check atomic In-Reply-To: (Michael Montalbo via GitGitGadget's message of "Wed, 08 Jul 2026 02:59:42 +0000") References: Date: Wed, 08 Jul 2026 12:58:47 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Michael Montalbo via GitGitGadget" writes: > From: Michael Montalbo > > http-429.sh records "already returned 429 once" with a "test -f" > followed by a "touch" of a shared state file. That check-then-act is not > atomic: Apache can run this CGI for several requests at once, and two of > them can both pass the "test -f" before either "touch"es, so both treat > themselves as the first request. The retry flow that drives this > endpoint is mostly sequential, so this has not been seen to fail, but > the race is latent. OK. And use of mkdir for atomicity is an obvious solution for such a situtation. > -if test -f "$state_file" > +if test "$retry_after" != permanent && ! mkdir "$state" 2>/dev/null > then > # Already returned 429 once, forward to git-http-backend > # Set PATH_INFO to just the repo path (without retry-after value) > @@ -52,9 +55,6 @@ then > exec "$GIT_EXEC_PATH/git-http-backend" > fi > > -# Mark that we've returned 429 > -touch "$state_file" > -