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

Re: [PATCH/RFC] grep: turn off threading when recursing submodules

From
Jeff King <peff@peff.net>
Date
Oct 19, 2017, 19:34 UTC
Message-ID
<20171019193413.prx5pkmwaxk6mpdt@sigill.intra.peff.net>
In-Reply-To
<20171019192618.GB84767@google.com>
On Thu, Oct 19, 2017 at 12:26:18PM -0700, Brandon Williams wrote:
Show 10 quoted lines
> One alternative to turning off threading would be to employ proper
> locking (like I failed to do) by wrapping the call the
> 'add_to_alternates_memory()' in calls to grep_read_lock/unlock:
> 
>   +       grep_read_lock();
>           add_to_alternates_memory(submodule.objectdir);
>   +       grep_read_unlock();
> 
> That way adding the submodule to the object database won't happen at the
> same time another thread is trying to read from the object store.

Yeah, I think that is the right approach. Many of Git's APIs aren't thread-safe, so we need a big mutex around "I am doing anything except actually looking at the already-read blob contents". We just missed this spot.

-Peff
Previous: Brandon WilliamsNext: Martin Ågren
Message 3 of 7 in “grep: turn off threading when recursing submodules”
  1. grep: turn off threading when recursing submodulesMartin Ågren, Oct 19, 2017
  2. Brandon WilliamsOct 19, 2017
  3. Jeff KingOct 19, 2017
  4. Martin ÅgrenOct 19, 2017
  5. grep: take the read-lock when adding a submoduleMartin Ågren, Nov 1, 2017
  6. Brandon WilliamsNov 1, 2017
  7. Jeff KingNov 1, 2017

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.