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

Re: RFC: error codes on exit

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 21, 2021, 01:20 UTC
Message-ID
<YKcK2elWqBQ+IVDt@camp.crustytoothpaste.net>
In-Reply-To
<YKWggLGDhTOY+lcy@google.com>
On 2021-05-19 at 23:34:24, Jonathan Nieder wrote:
Show 32 quoted lines
> Hi,
> 
> (Danger, jrn is wading into error handling again...)
> 
> At $DAYJOB we are setting up some alerting for some bot fleets and
> developer workstations, using trace2 as the data source.  Having
> trace2 has been great --- combined with gradual weekly rollouts of
> "next", it helps us to understand quickly when a change is creating a
> regression for users, which hopefully improves the quality of Git for
> everyone.
> 
> One kind of signal we haven't been able to make good use of is error
> rates.  The problem is that a die() call can be an indication of
> 
>  a. the user asked to do something that isn't sensible, and we kindly
>     rebuked the user
> 
>  b. we contacted a server, and the server was not happy with our
>     request
> 
>  c. the local Git repository is corrupt
> 
>  d. we ran out of resources (e.g., disk space)
> 
>  e. we encountered an internal error in handling the user's
>     legitimate request
> 
> and these different cases do not all motivate the same response.
> (E.g., if (c) affects just a single bot but produces a high error rate
> from that bot, we shouldn't be alarmed; if (d) is happening on a bot,
> then we should look into giving it more disk; if (e) is increasing
> significantly during a rollout then we should roll back quickly.)

In general, I'm in favor of adding some sort of error code here. Even though I don't normally use trace2, I think there's a lot of benefit to having a standardized set of error codes, and this seems like as good a place as any to introduce them.

A future iteration of this might look like us returning a negative error code from a function instead of -1 for us to signal to the caller that a particular error case occurred. We need not implement that now, of course, but I bring it up in case we want to accommodate that in our design now for future us.

I do agree with Peff that this may not necessarily provide all of the insight you want, since it can be hard to distinguish why the error occurred. For example, in Git LFS, we sometimes will pass objects we don't have to git rev-list (with --missing) and that's completely expected, whereas a missing object with git fsck would generally be cause for alarm. Provided you're comfortable with some ambiguity, I think this would be a nice improvement.

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: brian m. carlsonNext: Ævar Arnfjörð Bjarmason
Message 25 of 26 in “RFC: error codes on exit”
  1. Jonathan NiederMay 19, 2021
  2. Felipe ContrerasMay 20, 2021
  3. Alex HenrieMay 21, 2021
  4. H. Peter AnvinMay 21, 2021
  5. Bagas SanjayaMay 22, 2021
  6. Junio C HamanoMay 22, 2021
  7. H. Peter AnvinMay 22, 2021
  8. Felipe ContrerasMay 22, 2021
  9. H. Peter AnvinMay 22, 2021
  10. Felipe ContrerasMay 22, 2021
  11. H. Peter AnvinMay 22, 2021
  12. Philip OakleyMay 22, 2021
  13. Felipe ContrerasMay 22, 2021
  14. Alex HenrieMay 25, 2021
  15. Felipe ContrerasMay 25, 2021
  16. Junio C HamanoMay 20, 2021
  17. Felipe ContrerasMay 20, 2021
  18. Jonathan NiederMay 20, 2021
  19. Junio C HamanoMay 20, 2021
  20. Jeff KingMay 20, 2021
  21. Jonathan NiederMay 20, 2021
  22. Jeff KingMay 21, 2021
  23. Jeff HostetlerMay 20, 2021
  24. brian m. carlsonMay 21, 2021
  25. brian m. carlsonMay 21, 2021
  26. Ævar Arnfjörð BjarmasonMay 26, 2021

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.