Bug 648 - mono hangs on reading from child process
Summary: mono hangs on reading from child process
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Gonzalo Paniagua Javier
Depends on:
Reported: 2011-09-06 07:59 UTC by David Schmitt
Modified: 2012-02-10 02:23 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

gdb thread apply all bt full (102.43 KB, text/plain)
2011-09-06 07:59 UTC, David Schmitt
runnable example file (989 bytes, text/plain)
2011-09-16 06:23 UTC, David Schmitt
a logfile from the failing and running tests (3.05 KB, text/plain)
2011-09-16 06:26 UTC, David Schmitt

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description David Schmitt 2011-09-06 07:59:13 UTC
Created attachment 254 [details]
gdb thread apply all bt full

The code in question is running "git rev-list HEAD" and mono reproducibly hangs itself on reading from this command.

This is the calling code:

        protected virtual void ExecuteCommand(string fileName, string arguments,
            Action<string> outputHandler, Func<int, string, bool> errorHandler)
            StringBuilder error = new StringBuilder();

            using (Process process = new Process())
                process.StartInfo.FileName = fileName;
                process.StartInfo.Arguments = arguments;
                process.StartInfo.WorkingDirectory = Path;
                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError = true;

                process.OutputDataReceived += (o, e) =>
                        if (e.Data != null)

                process.ErrorDataReceived += (o, e) =>
                        if (e.Data != null)

            // Error handling omitted

I've attached a gdb thread apply all bt full log from the hanging process.

The hang goes away when I repack the underlying repository, pointing to some kind of timing error?

PS: the new bugzilla is much nicer than novell's!
Comment 1 David Schmitt 2011-09-06 08:09:41 UTC
I'm running mono-2-10/482e406
Comment 2 Zoltan Varga 2011-09-14 09:27:08 UTC
Please attach a complete test case.
Comment 3 David Schmitt 2011-09-16 06:23:23 UTC
Created attachment 395 [details]
runnable example file

I've packaged the example code into a small executable class. When I run this on Debian squeeze in my mono-2-10 clone/checkout it hangs two out of three times.

I'm using a locally compiled mono-2-10/482e406, I cannot seem to reproduce that against master/ed95f38.
Comment 4 David Schmitt 2011-09-16 06:26:27 UTC
Created attachment 396 [details]
a logfile from the failing and running tests

This is a logfile me running the compiled binary. Note that running the git rev-list takes around a second wallclock time. The processes which are aborted (^C) all were running more than four seconds (and would not return after longer waiting) and sometimes they run through in the expected second.

This behaviour is not reproducable with master, as demonstrated in the lower half of the log.
Comment 5 Gonzalo Paniagua Javier 2012-02-10 02:23:54 UTC
Can't reproduce with master or mono-2-10 ----Mono JIT compiler version (mono-2-10/2e069b5 Mon Jan  9 11:49:00 EST 2012)----