From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796129457; b=tDOb3qCoF6GAxzSDIg1FKL2/Gz9MROfGVv5G9jy/afj947hehgb5hxyfJEorUtt/qXUx EHiBQFytjaccNz4jML2LG9WAJ8GzCTJEO+HSzuywNrxKGCkeUZV3EblGzo4gD+gxCfj/y wRN+/cYnKPtOzVGdyDne1jJn26pEE8uf92YBi20UloLqKNPDakIhu9FMKrG5QMK7JnvGB /2pOQhXuiRFgsayS+d51RuVdlzGS0Z3YA42dtuCCDHya0kUcOzBYw2jrhSWhkjulIhj+W a9HzE+r3c4x0GbCqs0jk7auEjECbZUrlNy3AWtA+TE0OpvbW3qT1XuvlgYnsFBE3Yjw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796129457; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=VzRZkrKfBbSa72u1vONDu8DNher5d6SusJoNxo+00d8=; b=2vVcAbBh5+zimr7l0102a9ehvb4Xwm55sv0tcPBBHBEZwAkkktVpguZ83PjLBE77lg9k Gy+/qE1ilCz40Gf2sJL6hpV/35njZcbtzKMhPZitt5CaE7QpOOJlkbMyPgWI/pjsuQ+Jq QPOwvDrlxLNqS6vapTciAaQ9ZrSdt7u5u6K0NejARsgHO7RP0Nx11lInNK+16GkDNkM6D bt7qOj+DWhDOrlxmhb6zhmXlwgTe8wy4Xn91UVuMqlSH18mFVzYqCsD6eSOWFOShcq7qt Y1KUsqYXZMgHA+Lk/k1vI9HScxWOE04m3JqkjwO49fQeDzlQ7Gh0uB6q+xP9DQsFuMQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=XJT0uck8; arc=none smtp.remote-ip=209.85.215.170 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FF3C606A325 for ; Tue, 1 Dec 2026 12:50:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1FF3C606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=XJT0uck8 Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-cdb2dfcca94so5015045a12.1 for ; Tue, 01 Dec 2026 04:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796129456; x=1796734256; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VzRZkrKfBbSa72u1vONDu8DNher5d6SusJoNxo+00d8=; b=XJT0uck84Y31pp4p899XrG/OdhHaC6Ok9F0gNhdzz+OGYYd4yYsGyH9Wm15Qm/x6DP 58RS9vU4f2ZkSW3Iy3Q2h5QiqALl6i+f+Pz2e4YpvcsRzUZlquvpbxuXzosPtMIxRK94 rbBaAhPIP6KsSi3eBmdM50+d6fSa/Q1jWndFpC9SX4fKUmB6aGDnBJUw5WpIWPuw9Xsy RL2aUd/Q9Djg05A/E5kXH4yvMjSatq/UaUcj7MygNoHPKtFLrP1uYr7tKIZCP283Q4Y/ hZu0AtHOpu0Ud1VFJS0W90ev3u6dvf5wcO0hPpokiTlcFkh5TNbkMIA0prKginXJ3pjM tUXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796129456; x=1796734256; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VzRZkrKfBbSa72u1vONDu8DNher5d6SusJoNxo+00d8=; b=ntxsnJK76AwB9FluuyBkr9f2KXMW8yXepwSkHzivRNUK6Q3pg29QdzYKZSH3t1Ryiy aOH+m8C/++NQNSzTjucSfloxDPkjfJucvkYFYi7sFDIzKIlK+RArp0XPOBg0p8XWckSB FyQH984pKJ+o8lm8YxDAnyG6h3XEvtQLQfrmlrNVDkEQ/D7zup78NseTgpxQEvgyITQ4 lQ8SBUQW152Vo3TWfU7UHLpjSLuZjW2kurD3Py/n8ykwjmyRhGTtIqip3J+DiSi0WN9S CSE/j125ZTkTxjr5WgNhiYTqvLVTlAfbuSbOpqv7hQeOBlKTp6WY5FAJc/W6/10K/T/q K8xA== X-Gm-Message-State: APuU4Z+H0LAlsUuXIqvDAPf8MeEw3KRnzdszT4G0YAqpxWnDHI2JAFSu c5c9L0Wz0EC0aaiA/wjHcwSu2cfQzac8Sq/EgBxJJIr81rpYu69Or884 X-Gm-Gg: AZFdTZcaehh2P1LhdWBsA4OHVPuGZ6D/BvmIG/BqbjQ3de0BTaxSjPloQ50ZABM7vCn CZys7YlhJ42iw/qE00xNcJx5rD+arhk13HxWYJy/OQDb/ikJCHDCqY97nDYigmrD4rkfiFoC+z3 6I+1aa1P3ekMCJfSg+UScxILbfEQGCy+yfJj0JcDclXQqO6LXbA1ILAKRZ52nUc1dtAbEroSOrj Yms9+d2lm0ftEbH0LMjYkHGAK6hmLB7SUDKqYnHTx+RIAYOTLB2hqr4o2gU+GOMYk7T2eLn4KDI Gn3OpiwZKeAx15TmdNtI594KmRsFVILhkn7qCztq7D/qBYN4ZbnXT3lvrHJNMZ7ITeZ3ZCc64TK 0cFbfUUALs1PN3Hm0sKTDP/QbpfyX8cOilu5+KB22BOEiLE9xBANQUk3cTs0LOvHSV3Q+GC7WGm xc4s8qfKTEWoXxoycwBOBjSvbAB1P/5q0iODC9/c86UetVQ0xL+s51+4xPRLx3TIsVpZTwmZ7hI 6L4Vez4kvfhB4TXAcVpgt4ltvhwZXZv3Lc+f8pSWvaEz96jh2hahZonDRcyRnw9WrFynwhxgSp3 AEX4e9xjQSKlBGE/CZk7b755OAPsh4rb8nWTVyvZyg== X-Received: by 2002:a05:6300:8095:b0:3f8:f792:2373 with SMTP id adf61e73a8af0-4014c2573b2mr33757063637.48.1796129456002; Tue, 01 Dec 2026 04:50:56 -0800 (PST) Received: from [192.168.1.34] ([103.215.237.185]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8d329855224sm8004593b3a.38.2026.12.01.04.50.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 04:50:55 -0800 (PST) Message-ID: <3fba9f96-47e3-47c0-b540-92af0190fdc3@gmail.com> Date: Tue, 1 Dec 2026 18:20:52 +0530 X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/2] test-lib: run EXPENSIVE tests one at a time To: Patrick Steinhardt Cc: Git mailing list , Harald Nordgren , Junio C Hamano References: <20261128-ks-ci-long-test-hang-fix-v4-0-f117badd2e13@gmail.com> <20261128-ks-ci-long-test-hang-fix-v4-1-f117badd2e13@gmail.com> <17e17015-53a8-4887-9891-7a7f2f16ea6c@gmail.com> Content-Language: en-US From: Kaartic Sivaraam In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/1/26 16:37, Patrick Steinhardt wrote: > On Tue, Dec 01, 2026 at 02:17:48PM +0530, Kaartic Sivaraam wrote: >> On 12/1/26 12:52, Patrick Steinhardt wrote: >>>> + >>>> +acquire_expensive_lock_ () { >>>> + local owner waited= tmp="$expensive_lock_.$$" misses=0 >>>> + mkdir -p "$TEST_RESULTS_DIR" || >>>> + { expensive_lock_unavailable_; return 0; } >>>> + # The lock is a hard link to a file that already holds our PID, so >>>> + # it never exists without its owner recorded in it. Remove any >>>> + # $tmp left by a dead process with our PID first: it may still be >>>> + # linked to that process's lock, which writing to it would empty. >>>> + rm -f "$tmp" >>> >>> Nit: it is expected that in most cases this won't do anything, so in the >>> expected common case we'll see an error message. Do we want to silence >>> this? >>> >> >> I guess that was mostly done to keep things consistent as we pretty much >> silence everything in this function. So, I tend to prefer keeping the '-f' >> on this one too. > > Oh, the "-f" should be kept indeed. But shouldn't it be `2>/dev/null`? > > Ah, no, rm(1) doesn't actually complain in case the target path does not > exist. I thought it did. One week off and I've already forgotten > everything. > I guess you're just warming up from the time off ;-) >>> I feel like re-checking the lock owner is kind of pointless here. The >>> check doesn't fix the race, but it suggests it to the reader. And that >>> is overall fine, because the intent now is to fail in a way that we >>> prefer to run the test instead of blocking forever. >>> >>> But it raises the question why we even bother to check again. To me it >>> only causes puzzlement. >>> >> >> The re-check is present in order to prevent a specific race scenario pointed >> out by Junio: >> >>> * T1 holds $expensive_lock_, finishes its last EXPENSIVE test, >>> calls release_expensive_lock_ (rm -rf "$expensive_lock_"), and >>> exits. >>> >>> * Waiter T2 read owner=$(cat "$expensive_lock_/pid" 2>/dev/null) >>> (obtaining T1's PID) just before T1 removed the directory. >>> >>> * Waiter T3 runs mkdir "$expensive_lock_", succeeds, writes T3's >>> PID to pid, and begins its EXPENSIVE test. >>> >>> * T2 now checks test -n "$owner" && ! kill -0 "$owner" 2>/dev/null >>> against T1's exited PID, finds that T1 is gone, runs rm -rf >>> "$expensive_lock_", which deletes T3's active lock. It loops, >>> succeeds on mkdir "$expensive_lock_", and runs its EXPENSIVE test >>> concurrently with T3. >> >> >> It talks about the variant that created directories but it applies for the >> current linking variant also. >> >> If we could improve the comment above the relevant code in someway, do let >> me know. It tries to convey it but I unfortunately couldn't get what detail >> it is missing. > > But the race isn't fully fixed, is it? You have simply narrowed the race > window, but the race itself still exists between `test $(cat > "$expensive_lock_" = "$owner")` and the `rm -f`, doesn't it? > Ah. That is true indeed. Though, without the re-check, makes overlaps after a SIGKILL more common: in a small stress test they went from about 3 per run to about 15. So, I kind of lean towards keeping it since it doesn't cost us much. -- Sivaraam