git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] lock_packed_refs(): allow retries when acquiring the packed-refs lock

From
Stefan Beller <sbeller@google.com>
Date
May 11, 2015, 17:49 UTC
Message-ID
<CAGZ79kYc91z5S9j_hpA3b9-TvMBxr9jkdxhqEgHhOCT3mGzH5w@mail.gmail.com>
In-Reply-To
<20150511164941.GA30541@peff.net>
On Mon, May 11, 2015 at 9:49 AM, Jeff King <peff@peff.net> wrote:
Show 12 quoted lines
> On Mon, May 11, 2015 at 12:26:23PM +0200, Michael Haggerty wrote:
>
>> > So something like 100ms max backoff makes sense to me, in that it keeps
>> > us in the same order of magnitude as the expected time that the lock is
>> > held. [...]
>>
>> I don't understand your argument. If another process blocks us for on
>> the order of 100 ms, the backoff time (reading from my table) is less
>> than half of that.
>
> I think it is just that I was agreeing with you, but communicated it
> badly. I think your series is fine as-is.

By now I also think your series is fine as is. I am currently implementing something similar for Gerrit and I realize testing time based things is a royal pain in the butt. The tests you propose just take wall clock time and all should is good, though slowing down the test suite by another second or three in the worst case.

So for tests in Gerrit I use a dedicated java class which is specialized to pretend different times, such that you can write:

    doThings();
    pretendTimePassing(1 second);
    checkResultsFromThreads();

but running the tests takes less than 1 second as it's no real wall clock time passing.

On my machine there is /bin/usleep - sleep some number of microseconds which may be better for running the test suite. I don't know if it's worth the hassle of checking if that program is there and selectively running a faster version of said test though.

That said, I'm personally fine with the waste of 1 second as I view running the test suite as a long waiting game anyway. Maybe Junio as the maintainer (I assume he runs more tests than all of us?) dislikes waiting for the second all the time?

>
> -Peff
Previous: Jeff KingNext: Stefan Beller
Message 16 of 18 in “Retry attempts to acquire the packed-refs lock”
  1. 0/2 Retry attempts to acquire the packed-refs lockMichael Haggerty, May 1, 2015
  2. 1/2 lockfile: allow file locking to be retried with a timeoutMichael Haggerty, May 1, 2015
  3. Junio C HamanoMay 11, 2015
  4. 2/2 lock_packed_refs(): allow retries when acquiring the packed-refs lockMichael Haggerty, May 1, 2015
  5. Johannes SixtMay 1, 2015
  6. Michael HaggertyMay 2, 2015
  7. Johannes SixtMay 2, 2015
  8. Michael HaggertyMay 11, 2015
  9. Stefan BellerMay 1, 2015
  10. Jeff KingMay 1, 2015
  11. Michael HaggertyMay 2, 2015
  12. Stefan BellerMay 4, 2015
  13. Jeff KingMay 5, 2015
  14. Michael HaggertyMay 11, 2015
  15. Jeff KingMay 11, 2015
  16. Stefan BellerMay 11, 2015
  17. Stefan BellerMay 11, 2015
  18. Junio C HamanoMay 3, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.