Skip to content

Conversation

@vaidas-shopify
Copy link

@vaidas-shopify vaidas-shopify commented Nov 24, 2025

No description provided.

@gitgitgadget
Copy link

gitgitgadget bot commented Nov 24, 2025

Welcome to GitGitGadget

Hi @vaidas-shopify, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests.

Please make sure that either:

  • Your Pull Request has a good description, if it consists of multiple commits, as it will be used as cover letter.
  • Your Pull Request description is empty, if it consists of a single commit, as the commit message should be descriptive enough by itself.

You can CC potential reviewers by adding a footer to the PR description with the following syntax:

CC: Revi Ewer <[email protected]>, Ill Takalook <[email protected]>

NOTE: DO NOT copy/paste your CC list from a previous GGG PR's description,
because it will result in a malformed CC list on the mailing list. See
example.

Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:

  • the lines should not exceed 76 columns,
  • the first line should be like a header and typically start with a prefix like "tests:" or "revisions:" to state which subsystem the change is about, and
  • the commit messages' body should be describing the "why?" of the change.
  • Finally, the commit messages should end in a Signed-off-by: line matching the commits' author.

It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code.

Contributing the patches

Before you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form /allow. A good way to find other contributors is to locate recent pull requests where someone has been /allowed:

Both the person who commented /allow and the PR author are able to /allow you.

An alternative is the channel #git-devel on the Libera Chat IRC network:

<newcontributor> I've just created my first PR, could someone please /allow me? https://github.com/gitgitgadget/git/pull/12345
<veteran> newcontributor: it is done
<newcontributor> thanks!

Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment /submit.

If you want to see what email(s) would be sent for a /submit request, add a PR comment /preview to have the email(s) sent to you. You must have a public GitHub email address for this. Note that any reviewers CC'd via the list in the PR description will not actually be sent emails.

After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail).

If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the (raw) link), then import it into your mail program. If you use GMail, you can do this via:

curl -g --user "<EMailAddress>:<Password>" \
    --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):

Changes since v1:
- Fixed a typo in the commit message (found by ...)
- Added a code comment to ... as suggested by ...
...

To send a new iteration, just add another PR comment with the contents: /submit.

Need help?

New contributors who want advice are encouraged to join [email protected], where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join.

You may also be able to find help in real time in the developer IRC channel, #git-devel on Libera Chat. Remember that IRC does not support offline messaging, so if you send someone a private message and log out, they cannot respond to you. The scrollback of #git-devel is archived, though.

@pcasaretto
Copy link

/allow

@gitgitgadget
Copy link

gitgitgadget bot commented Nov 24, 2025

User vaidas-shopify is now allowed to use GitGitGadget.


/* Parse Retry-After header for rate limiting */
if (skip_iprefix_mem(ptr, size, "retry-after:", &val, &val_len)) {
strbuf_add(&buf, val, val_len);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fairly certain that this is the data that's leaked, which is the reason for this test failure.

Sadly, the reporting of these -leaks jobs leaves a lot to be desired.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fairly certain that this is the data that's leaked, which is the reason for this test failure.

Sadly, the reporting of these -leaks jobs leaves a lot to be desired.

I got tests passing with the following fix: d4a5896

@gitgitgadget
Copy link

gitgitgadget bot commented Nov 25, 2025

There are issues in commit 293af7e:
test memory leak
Commit checks stopped - the message is too short
Commit not signed off

@vaidas-shopify vaidas-shopify force-pushed the retry-after branch 3 times, most recently from c9faf53 to 5b859d1 Compare November 25, 2025 08:36
@dscho
Copy link
Member

dscho commented Nov 25, 2025

Range-diff
  • -: ----------- > 1: f82e430 odb: fix subtle logic to check whether an alternate is usable

  • -: ----------- > 2: 0820a4b odb: introduce odb_source_new()

  • -: ----------- > 3: c2da110 odb: adjust naming to free object sources

  • -: ----------- > 4: 0cc12de object-file: move fetch_if_missing

  • -: ----------- > 5: ece43d9 object-file: introduce struct odb_source_loose

  • -: ----------- > 6: 90a93f9 object-file: move loose object cache into loose source

  • -: ----------- > 7: be659c9 object-file: hide internals when we need to reprepare loose sources

  • -: ----------- > 8: 376016e object-file: move loose object map into loose source

  • -: ----------- > 9: ff7ad5c object-file: read objects via the loose object source

  • -: ----------- > 10: 05130c6 object-file: rename has_loose_object()

  • -: ----------- > 11: f2bd88a object-file: refactor freshening of objects

  • -: ----------- > 12: bfb1b2b object-file: rename write_object_file()

  • -: ----------- > 13: 3e5e360 object-file: refactor writing objects via a stream

  • -: ----------- > 14: e031fa1 replay: use die_for_incompatible_opt2() for option validation

  • -: ----------- > 15: 15cd4ef replay: make atomic ref updates the default behavior

  • -: ----------- > 16: 336ac90 replay: add replay.refAction config option

  • -: ----------- > 17: 46207a5 doc: clarify server behavior for invalid 'want' lines in HTTP protocol

  • -: ----------- > 18: 42ed046 attr: avoid recursion when expanding attribute macros

  • -: ----------- > 19: 4580bcd osxkeychain: avoid incorrectly skipping store operation

  • -: ----------- > 20: df90ecc doc: commit: link to git-status(1) on all format options

  • -: ----------- > 21: 66c78e0 object-file: disallow adding submodules of different hash algo

  • -: ----------- > 22: 6fe288b read-cache: drop submodule check from add_to_cache()

  • -: ----------- > 23: 878fef8 t/unit-tests: add UTF-8 width tests for CJK chars

  • -: ----------- > 24: 7a03a10 builtin/repo: fix table alignment for UTF-8 characters

  • -: ----------- > 25: 6ab38b7 The third batch

  • 1: 2352f80 = 26: 4c33b82 http: add support for HTTP 429 rate limit retries

  • 2: ceeb569 ! 27: 5b859d1 remote-curl: fix memory leak in discover_refs() error paths

    @@ Commit message
         case (HTTP_MISSING_TARGET, HTTP_NOAUTH, HTTP_NOMATCHPUBLICKEY,
         HTTP_RATE_LIMITED, and the default case).
     
    -    Signed-off-by: Vaidas <[email protected]>
    +    Signed-off-by: Vaidas Pilkauskas <[email protected]>
     
      ## remote-curl.c ##
     @@ remote-curl.c: static struct discovery *discover_refs(const char *service, int for_push)

@vaidas-shopify without addressing the strbuf leak, there is little reason to hope that the -leaks jobs will start to succeed.

Add retry logic for HTTP 429 (Too Many Requests) responses to handle
server-side rate limiting gracefully. When Git's HTTP client receives
a 429 response, it can now automatically retry the request after an
appropriate delay, respecting the server's rate limits.

The implementation supports the RFC-compliant Retry-After header in
both delay-seconds (integer) and HTTP-date (RFC 2822) formats. If a
past date is provided, Git retries immediately without waiting.

Retry behavior is controlled by three new configuration options:

  * http.maxRetries: Maximum number of retry attempts (default: 0,
    meaning retries are disabled by default). Users must explicitly
    opt-in to retry behavior.

  * http.retryAfter: Default delay in seconds when the server doesn't
    provide a Retry-After header (default: -1, meaning fail if no
    header is provided). This serves as a fallback mechanism.

  * http.maxRetryTime: Maximum delay in seconds for a single retry
    (default: 300). If the server requests a delay exceeding this
    limit, Git fails immediately rather than waiting. This prevents
    indefinite blocking on unreasonable server requests.

All three options can be overridden via environment variables:
GIT_HTTP_MAX_RETRIES, GIT_HTTP_RETRY_AFTER, and
GIT_HTTP_MAX_RETRY_TIME.

The retry logic implements a fail-fast approach: if any delay
(whether from server header or configuration) exceeds maxRetryTime,
Git fails immediately with a clear error message rather than capping
the delay. This provides better visibility into rate limiting issues.

Trace2 logging has been added to track retry attempts, delays, and
error conditions. This enables monitoring and debugging of rate limit
scenarios in production environments.

The implementation includes extensive test coverage for basic retry
behavior, Retry-After header formats (integer and HTTP-date),
configuration combinations, maxRetryTime limits, invalid header
handling, environment variable overrides, and edge cases.

Signed-off-by: Vaidas Pilkauskas <[email protected]>
Fix a memory leak in show_http_message() that was triggered when
displaying HTTP error messages before die(). The function would call
strbuf_reencode() which modifies the caller's strbuf in place,
allocating new memory for the re-encoded string. Since this function
is only called immediately before die(), the allocated memory was
never explicitly freed, causing leak detectors to report it.

The leak became visible when HTTP 429 rate limit retry support was
added, which introduced the HTTP_RATE_LIMITED error case. However,
the issue existed in pre-existing error paths as well
(HTTP_MISSING_TARGET, HTTP_NOAUTH, HTTP_NOMATCHPUBLICKEY) - the new
retry logic just made it more visible in tests because retries
exercise the error paths more frequently.

The leak was detected by LeakSanitizer in t5584 tests that enable
retries (maxRetries > 0). Tests with retries disabled passed because
they took a different code path or timing.

Fix this by making show_http_message() work on a local copy of the
message buffer instead of modifying the caller's buffer in place:

1. Create a local strbuf and copy the message into it
2. Perform re-encoding on the local copy if needed
3. Display the message from the local copy
4. Properly release the local copy before returning

This ensures all memory allocated by strbuf_reencode() is freed
before the function returns, even though die() is called immediately
after, eliminating the leak.

Signed-off-by: Vaidas Pilkauskas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants