Bug 3185 - NLog causes a sigsegv when the application is running in MD
Summary: NLog causes a sigsegv when the application is running in MD
Status: RESOLVED NORESPONSE
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-02-01 17:18 UTC by David Ferguson
Modified: 2014-01-12 15:30 UTC (History)
4 users (show)

Tags:
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:
Status:
RESOLVED NORESPONSE

Description David Ferguson 2012-02-01 17:18:19 UTC
When running my app within MonoDevelop, I get the following when calling .Log on NLog:


Info 2/1/2012 5:03:21 PM - Running in console mode.  Press Control-C to quit.
Debug 2/1/2012 5:03:22 PM - Default connection limit is {0}
Debug 2/1/2012 5:03:22 PM - Default connection limit is now {0}
Debug 2/1/2012 5:03:22 PM - Default connection limit is {0}
Debug 2/1/2012 5:03:22 PM - Default connection limit is {0}
Debug 2/1/2012 5:03:22 PM - Service {0} registering
Debug 2/1/2012 5:03:22 PM - Service {0} registered
Info 2/1/2012 5:03:22 PM - No server thumbprint found, generating new certificate
Debug 2/1/2012 5:03:22 PM - Creating SSL certificate: {0}
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Diagnostics.StackFrame.get_frame_info (int,bool,System.Reflection.MethodBase&,int&,int&,string&,int&,int&) <IL 0x00018, 0xffffffff>
  at System.Diagnostics.StackFrame..ctor (int,bool) [0x00014] in /home/replaced/Development/mono/mcs/class/corlib/System.Diagnostics/StackFrame.cs:89
  at System.Diagnostics.StackTrace.init_frames (int,bool) [0x00033] in /home/replaced/Development/mono/mcs/class/corlib/System.Diagnostics/StackTrace.cs:83
  at System.Diagnostics.StackTrace..ctor (int,bool) [0x00006] in /home/replaced/Development/mono/mcs/class/corlib/System.Diagnostics/StackTrace.cs:70
  at NLog.LoggerImpl.Write (System.Type,NLog.Internal.TargetWithFilterChain,NLog.LogEventInfo,NLog.LogFactory) <IL 0x0002a, 0x00137>
  at NLog.Logger.WriteToTargets (System.Type,NLog.LogEventInfo) <IL 0x00014, 0x0008b>
  at NLog.Logger.Log (System.Type,NLog.LogEventInfo) <IL 0x00011, 0x0007b>
  at replaced.Logging.Logger.LogException (replaced.Logging.LogLevel,System.Exception,string) [0x00026] in (null):92
  at replaced.Logging.Logger.ErrorException (System.Exception,string) [0x00000] in (null):239
  at replaced.Agent.Service.Program.StartAgentSafe (System.Action) [0x00019] in /home/replaced/Development/replaced/replaced/services/agent/Agent.Implementation.Linux/Program.cs:77
  at replaced.Agent.Service.Program.StartService (string[]) [0x00072] in /home/replaced/Development/replaced/replaced/services/agent/Agent.Implementation.Linux/Program.cs:27
  at replaced.Agent.Service.Program.Main (string[]) [0x00000] in /home/replaced/Development/replaced/replaced/services/agent/Agent.Implementation.Linux/Program.cs:14
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

	/home/replaced/.local/bin/mono() [0x4982e2]
	/home/replaced/.local/bin/mono() [0x4eaaaf]
	/home/replaced/.local/bin/mono() [0x41c127]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x10060) [0x7f8a83ba2060]
	/lib/x86_64-linux-gnu/libc.so.6(+0x82721) [0x7f8a83875721]
	/home/replaced/.local/bin/mono(mono_string_new+0x1c) [0x56d4bc]
	/home/replaced/.local/bin/mono() [0x496d35]
	[0x41f42265]

Debug info from gdb:

Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

bash: line 1:  4304 Aborted                 /home/replaced/.local/bin/mono --debug --debugger-agent=transport=dt_socket,address=127.0.0.1:52131 "/home/replaced/Development/replaced/replaced/services/agent/Agent.Implementation.Linux/bin/Debug/Agent.Implementation.Linux.exe" /debug

Press any key to continue...


This doesn't happen when I'm running the application from the console.  The log message successfully is printed.  This happens from MD, both when using the debugger and when running without the debugger.


$ mono --version
Mono JIT compiler version 2.11 (master/be171d2 Tue Jan 31 09:49:31 EST 2012)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            Included Boehm (with typed GC and Parallel Mark)

$ monodevelop -h
MonoDevelop 2.8.5
Comment 1 David Ferguson 2012-02-01 17:20:25 UTC
I tested using the --debug outside of mono, and it exhibited the same behavior.
Comment 2 Zoltan Varga 2012-02-04 09:05:52 UTC
Could you create a testcase ?
Comment 3 David Ferguson 2012-02-06 17:57:33 UTC
I've been trying to recreate this in a test project...looks like this is only happening when NLog is configured to work with gibraltar.  What's interesting is that this only happens with the --debug flag passed to mono (with or without MD).

I'm not sure if gibraltar is compatible with mono, but I'll look into it some more.  In any case, I'll try to determine why mono is not throwing a managed exception instead of a sigsegv.
Comment 4 Zoltan Varga 2012-03-01 22:19:32 UTC
-> NEEDINFO.
Comment 5 David Ferguson 2012-03-01 22:23:46 UTC
I spoke to the guys at Gibraltar.  Their newest version of their all shouldn't cause the sigsev anymore.  I believe it was due to some code that interacts with the debugger, but I'm not certain.  I will try to get more details.
Comment 6 Rodrigo Kumpera 2014-01-12 15:30:53 UTC
No news on this bug for 19 months. Reopen if it happens again.