Bug 13933 - [REGRESSION] Full mono lockup
Summary: [REGRESSION] Full mono lockup
Status: RESOLVED DUPLICATE of bug 13951
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2013-08-12 16:08 UTC by Nikita Tsukanov
Modified: 2013-08-14 10:03 UTC (History)
4 users (show)

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

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 Nikita Tsukanov 2013-08-12 16:08:21 UTC
Hello. There was a long thread the in mailing list related to this problem: http://mono.1490590.n4.nabble.com/NancyFX-self-hosting-HttpListener-locking-up-on-linux-tt4660392.html

Actually the following code causes the issue:

using System;
using System.Threading;
using System.IO;
using System.Collections.Generic;
using Nancy;
using Nancy.IO;

namespace Sandbox
	class MainClass
		static INancyEngine _engine;
		public static void Main(string[] args)
			var bt = new DefaultNancyBootstrapper ();
			bt.Initialise ();
			_engine = bt.GetEngine ();
			for (int c=0; c<10; c++)
				new Thread (ThreadProc).Start ();
			Thread.Sleep (-1);

		static void ThreadProc ()
			int crid = 0;
			while (true) {
				crid ++;
				var resp = _engine.HandleRequest (
					new Request ("GET", "/",
				             new Dictionary<string, IEnumerable<string>> (),
				             RequestStream.FromStream (new MemoryStream (), 0, 0), "http", "", ""));
				resp.Response.Contents (new MemoryStream ());
				Console.WriteLine ("Request #{0} done", crid);


	public class TestController : NancyModule
		public TestController ()
			Get ["/"] = _ => "test";

It should be run WITHOUT debugger attached (i. e. without --debugger-agent option, with debugger you won't be able to reproduce the issue).

You can get NancyFx here: https://github.com/NancyFx/Nancy

After a while (usually 3-5 seconds) it completely locks up (even SIGQUIT just prints "Full thread dump:" and nothing else) or even segfaults.

This issue can be reproduced in Mono 3.0.6, Mono 3.2 and Mono 3.3 (master)

Mono 2.10.8 (from Ubuntu repos) works fine.
Comment 1 Andres G. Aragoneses 2013-08-14 03:55:58 UTC
When you say "after a while", I guess you mean "after a while of sending HTTP requests with jMeter"?

BTW, there has been a fix of a hang in master recently (https://github.com/mono/mono/commit/a31b580fdcbaa9a8a16d59ffb12d04f5872f54e8) to fix bug 13951. Hopefully it helps this bug too? Can you test?
Comment 2 Nikita Tsukanov 2013-08-14 07:16:10 UTC
As you can see in my test case it doesn't listen any ports, just creates fake NancyFx requests, passes them to INancyEngine and writes responses to MemoryStream. So the issue is somewhere in core part of the Mono runtime.

I'll try to reproduce it with a31b580fdcbaa9a8a16d59ffb12d04f5872f54e8 applied.
Comment 3 Nikita Tsukanov 2013-08-14 10:03:31 UTC
Seems to be fixed with that commit.

*** This bug has been marked as a duplicate of bug 13951 ***