www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19231] New: Infinite loop in exception chains

https://issues.dlang.org/show_bug.cgi?id=19231

          Issue ID: 19231
           Summary: Infinite loop in exception chains
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: dhasenan gmail.com

void throwy()
{
  auto e = new Exception("root");
  scope (exit) throw new Exception("scope 1", e);
  throw e;
}

void main()
{
  throwy();
}


This results in an infinite loop in druntime. There are only two exceptions,
but because they form a loop instead of a proper linked list, druntime keeps on
printing them.

Perhaps we should define a reasonable limit on the number of exceptions we
print before quitting out. 10 should probably be plenty.

--
Sep 06 2018