Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitconfig: avoid deadlock on large amounts of config data #183

Merged

Conversation

dscho
Copy link
Collaborator

@dscho dscho commented Sep 25, 2020

This fixes the problem I encountered today after upgrading from GCM Core v2.0.194.40577 to v2.0.246.34937: due to the sheer size of my repository config (git config -l produces over 25kB of data), the credential manager would just hang, waiting for git config to be done, while the latter waited for the former to read its output.

As per the Remarks section in
https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.redirectstandardoutput
we should first read the output until the end before waiting for the
`git config` process to finish, to avoid deadlocks.

This indeed helps in the situation of this developer whose config is so
large that `git config -l` produces 25 kilobyte worth of output.
Apparently, this fills up some buffer that seems to be around 8kB and
then `git config -l` waits for its output to be consumed, and before
this patch, the consumer (i.e. GCM Core) would wait for `git config -l`
to exit already.
@dscho dscho force-pushed the avoid-deadlocks-when-reading-the-config branch from a6c55f1 to 15c11c6 Compare September 25, 2020 20:46
Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

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

:shipit:

@mjcheetham
Copy link
Collaborator

git config -l produces over 25kB of data

P.s., yes this exposed a bug in GCM Core, but perhaps you should consider trimming your config.. just a bit? 🤣
git config --war-and-peace

@mjcheetham mjcheetham merged commit 815e267 into git-ecosystem:master Sep 28, 2020
@dscho dscho deleted the avoid-deadlocks-when-reading-the-config branch September 28, 2020 10:32
@dscho
Copy link
Collaborator Author

dscho commented Sep 28, 2020

perhaps you should consider trimming your config.. just a bit? 🤣
git config --war-and-peace

I know I have a lot of branches and remotes... But it's not my fault that git/git has so many forks that I need to keep track of! 😁

$ git remote -v | wc
     58     174    3095

$ git config --get-regexp 'branch\..*\.remote' | wc
     83     166    3682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants