From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id EFBC51F86C for ; Wed, 25 Nov 2020 09:37:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbgKYJhJ (ORCPT ); Wed, 25 Nov 2020 04:37:09 -0500 Received: from cloud.peff.net ([104.130.231.41]:41892 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbgKYJhJ (ORCPT ); Wed, 25 Nov 2020 04:37:09 -0500 Received: (qmail 9094 invoked by uid 109); 25 Nov 2020 09:37:08 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Wed, 25 Nov 2020 09:37:08 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27724 invoked by uid 111); 25 Nov 2020 09:37:08 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Wed, 25 Nov 2020 04:37:08 -0500 Authentication-Results: peff.net; auth=none Date: Wed, 25 Nov 2020 04:37:07 -0500 From: Jeff King To: Junio C Hamano Cc: =?utf-8?B?U2ltw6Nv?= Afonso , git@vger.kernel.org Subject: Re: [PATCH v2] crendential-store: use timeout when locking file Message-ID: References: <20201124193208.74fe4mticgkbxou3@safonso-t430> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Nov 24, 2020 at 02:08:01PM -0800, Junio C Hamano wrote: > Simão Afonso writes: > > > +credentialStore.fileTimeout:: > > + The length of time, in milliseconds, for git-credential-store to retry > > + when trying to lock the credentials file. Value 0 means not to retry at > > + all; -1 means to try indefinitely. Default is 1000 (i.e., retry for > > + 1s). > > I do not remember what was said in the first round of the review, > but I wonder if this is the best name for users. I think it is good > enough, but do ".lockTimeout" or ".lockTimeoutMS" make it even > easier to grok, perhaps? Yeah, I think those are a bit more obvious. > > + > > + if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0) > > + die_errno("unable to get credential storage lock in %d ms", timeout_ms); > > Should this be die_errno()? Looking at lock_file_timeout(), I am > not sure if the value of errno is valid in all codepaths that return > failure. I think it's the right thing here. Inside hold_lock_file_for_update_timeout(), we'd pass errno to unable_to_lock_die(), etc. So if there is a code path in lock_file_timeout() that isn't setting errno properly, we should probably be fixing that. Another option would be to just pass LOCK_DIE_ON_ERROR here, but I think for this use I prefer the smaller "unable to lock" to the big "another git process may have crashed" advice message we'd give in that case. -Peff