[Mono-bugs] [Bug 502944] New: StackOverflowException caused by TraceSource

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 11 23:02:47 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=502944


           Summary: StackOverflowException caused by TraceSource
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: atsushi at ximian.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10 GTB5

(translating reported bug from Japanese community)

If we write settings for trace source in the app config, it results in
StackOverflowException.

It is probably because the r133291 changes caused TraceListenerCollection
constructor giving infinite loop.
http://anonsvn.mono-project.com/viewvc?view=rev&revision=133291

1. TraceImpl.InitOnce is called from TraceImpl.IndentLevel.
2. TraceSourceInfo instance is created when DiagnosticsConfiguration.Settings
is referenced.
3. TraceSourceInfo creates an instance of TraceListenerCollection.
4. TraceListenerCollection constructor calls Add(), then InitializeListener()
in turn.
5. InitializeListener references TraceImpl.IndentLevel.
6. goto 1 (infinite loop)



Reproducible: Always

Steps to Reproduce:
repro:

[trace.cs]
  using System;
  using System.Diagnostics;

  class MainClass {
    public static void Main(string[] args)
    {
      TraceSource traceSource = new TraceSource("source1");

      //traceSource.TraceEvent(TraceEventType.Error, 1, "error event");
    }
  }

[trace.exe.config]
  <?xml version="1.0" encoding="utf-8" ?>
  <configuration>
    <system.diagnostics>
      <trace autoflush="true"/>
      <sources>
        <source name="source1" switchName="switch"
switchType="System.Diagnostics.SourceSwitch">
          <!--
          <listeners>
            <add name="console"
type="System.Diagnostics.ConsoleTraceListener"/>
          </listeners>
          -->
        </source>
      </sources>
    </system.diagnostics>
  </configuration>


Actual Results:  
$ mono trace.exe
Stack overflow in unmanaged: IP: 0x58cac7, fault addr: 0x7fff71af7a58
Stack overflow in unmanaged: IP: 0x58cac7, fault addr: 0x7fff71af7f18

Unhandled Exception: System.StackOverflowException: The requested operation
caused a stack overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_new_fast
(intptr)
  at Mono.Xml2.XmlTextReader.IncrementAttributeToken () [0x00000] 
  at Mono.Xml2.XmlTextReader.ReadAttributes (Boolean isXmlDecl) [0x00000] 
  at Mono.Xml2.XmlTextReader.ReadStartTag () [0x00000] 
  at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] 
  at Mono.Xml2.XmlTextReader.Read () [0x00000] 
  at System.Xml.XmlTextReader.Read () [0x00000] 
  at System.Xml.XmlReader.MoveToContent () [0x00000] 
  at System.Configuration.ConfigurationElement.DeserializeElement
(System.Xml.XmlReader reader, Boolean serializeCollectionKey) [0x00000] 
  at System.Configuration.ConfigurationSection.DoDeserializeSection
(System.Xml.XmlReader reader) [0x00000] 
  at System.Configuration.ConfigurationSection.GetRuntimeObject () [0x00000] 
  at System.Configuration.ConfigurationSection.GetRuntimeObject () [0x00000] 
  at System.Configuration.ConfigurationSection.GetRuntimeObject () [0x00000] 
  at System.Configuration.ConfigurationSection.GetRuntimeObject () [0x00000] 
  at
System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection
(System.String configKey) [0x00000] 
  at System.Configuration.ConfigurationManager.GetSection (System.String
sectionName) [0x00000] 
  at System.Configuration.ConfigurationSettings.GetConfig (System.String
sectionName) [0x00000] 
  at System.Diagnostics.DiagnosticsConfiguration.get_Settings () [0x00000] 
  at System.Diagnostics.TraceImpl.InitOnce () [0x00000] 
  at System.Diagnostics.TraceImpl.get_IndentLevel () [0x00000] 
  at System.Diagnostics.TraceListenerCollection.InitializeListener
(System.Diagnostics.TraceListener listener) [0x00000] 
  at System.Diagnostics.TraceListenerCollection.Add
(System.Diagnostics.TraceListener listener) [0x00000] 
  at System.Diagnostics.TraceListenerCollection..ctor (Boolean addDefault)
[0x00000] 
  at System.Diagnostics.TraceListenerCollection..ctor () [0x00000] 
  at System.Diagnostics.TraceSourceInfo..ctor (System.String name, SourceLevels
levels) [0x00000] 
  at System.Diagnostics.DiagnosticsConfigurationHandler.AddTraceSource
(IDictionary d, System.Collections.Hashtable sources, System.Xml.XmlNode node)
[0x00000] 
  at System.Diagnostics.DiagnosticsConfigurationHandler.AddSourcesNode
(IDictionary d, System.Xml.XmlNode node) [0x00000] 
  at System.Diagnostics.DiagnosticsConfigurationHandler.Create (System.Object
parent, System.Object configContext, System.Xml.XmlNode section) [0x00000] 
  at System.Configuration.ConfigurationSection.GetRuntimeObject () [0x00000] 
  at
System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection
(System.String configKey) [0x00000] 
  at System.Configuration.ConfigurationManager.GetSection (System.String
sectionName) [0x00000] 
  at System.Configuration.ConfigurationSettings.GetConfig (System.String
sectionName) [0x00000] 
  at System.Diagnostics.DiagnosticsConfiguration.get_Settings () [0x00000] 
  at System.Diagnostics.TraceImpl.InitOnce () [0x00000] 
  at System.Diagnostics.TraceImpl.get_IndentLevel () [0x00000] 
  at System.Diagnostics.TraceListenerCollection.InitializeListener
(System.Diagnostics.TraceListener listener) [0x00000] 
      :
    (snip)
      :
  at System.Diagnostics.TraceImpl.get_IndentLevel () [0x00000]
  at System.Diagnostics.TraceListenerCollection.InitializeListener
(System.Diagnostics.TraceListener listener) [0x00000]
  at System.Diagnostics.TraceListenerCollection.Add
(System.Diagnostics.TraceListener listener) [0x00000]
  at System.Diagnostics.TraceListenerCollection..ctor (Boolean addDefault)
[0x00000]
  at System.Diagnostics.TraceListenerCollection..ctor () [0x00000]
  at System.Diagnostics.TraceSourceInfo..ctor (System.String name, SourceLevels
levels) [0x00000]
  at System.Diagnostics.DiagnosticsConfigurationHandler.AddTraceSource
(IDictionary d, System.Collections.Hashtable sources, System.Xml.XmlNode node)
[0x00000]
  at System.Diagnostics.DiagnosticsConfigurationHandler.AddSourcesNode
(IDictionary d, System.Xml.XmlNode node) [0x00000]
  at System.Diagnostics.DiagnosticsConfigurationHandler.Create (System.Object
parent, System.Object configContext, System.Xml.XmlNode section) [0x00000]
  at System.Configuration.ConfigurationSection.GetRuntimeObject () [0x00000]
  at
System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection
(System.String configKey) [0x00000]
  at System.Configuration.ConfigurationManager.GetSection (System.String
sectionName) [0x00000]
  at System.Configuration.ConfigurationSettings.GetConfig (System.String
sectionName) [0x00000]
  at System.Diagnostics.DiagnosticsConfiguration.get_Settings () [0x00000]
  at System.Diagnostics.TraceImpl.InitOnce () [0x00000]
  at System.Diagnostics.TraceImpl.get_IndentLevel () [0x00000]
  at System.Diagnostics.TraceListenerCollection.InitializeListener
(System.Diagnostics.TraceListener listener) [0x00000]
  at System.Diagnostics.TraceListenerCollection.Add
(System.Diagnostics.TraceListener listener) [0x00000]
  at System.Diagnostics.TraceListenerCollection..ctor (Boolean addDefault)
[0x00000]
  at System.Diagnostics.TraceListenerCollection..ctor () [0x00000]
  at System.Diagnostics.TraceSourceInfo..ctor (System.String name, SourceLevels
levels) [0x00000]
  at System.Diagnostics.DiagnosticsConfigurationHandler.AddTraceSource
(IDictionary d, System.Collections.Hashtable sources, System.Xml.XmlNode node)
[0x00000]
  at System.Diagnostics.DiagnosticsConfigurationHandler.AddSourcesNode
(IDictionary d, System.Xml.XmlNode node) [0x00000]
  at System.Diagnostics.DiagnosticsConfigurationHandler.Create (System.Object
parent, System.Object configContext, System.Xml.XmlNode section) [0x00000]
  at System.Configuration.ConfigurationSection.GetRuntimeObject () [0x00000]
  at
System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection
(System.String configKey) [0x00000]
  at System.Configuration.ConfigurationManager.GetSection (System.String
sectionName) [0x00000]
  at System.Configuration.ConfigurationSettings.GetConfig (System.String
sectionName) [0x00000]
  at System.Diagnostics.DiagnosticsConfiguration.get_Settings () [0x00000]
  at System.Diagnostics.TraceImpl.InitOnce () [0x00000]
  at System.Diagnostics.TraceImpl.get_IndentLevel () [0x00000]
  at System.Diagnostics.TraceListenerCollection.InitializeListener
(System.Diagnostics.TraceListener listener) [0x00000]
  at System.Diagnostics.TraceListenerCollection.Add
(System.Diagnostics.TraceListener listener) [0x00000]
  at System.Diagnostics.TraceListenerCollection..ctor (Boolean addDefault)
[0x00000]
  at System.Diagnostics.TraceListenerCollection..ctor () [0x00000]

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list