You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gitconfig: avoid deadlock on large amounts of config data
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.
// To avoid deadlocks, always read the output stream first and then wait
221
+
// TODO: don't read in all the data at once; stream it
222
+
stringdata=git.StandardOutput.ReadToEnd();
220
223
git.WaitForExit();
221
224
222
225
switch(git.ExitCode)
@@ -229,9 +232,6 @@ public IEnumerable<string> GetRegex(string nameRegex, string valueRegex)
229
232
$"Failed to get Git configuration multi-valued entry '{nameRegex}' with value regex '{valueRegex}'. Exit code '{git.ExitCode}' (level={_filterLevel})");
230
233
}
231
234
232
-
// TODO: don't read in all the data at once; stream it
0 commit comments