www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15946] New: Exception collected during unwinding

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

          Issue ID: 15946
           Summary: Exception collected during unwinding
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: dmdtracker supradigital.org

I have code within a fiber that looks roughly like this:

```
try { .. }
finally 
{
     /* code that yields the fiber for some time */
}
```

When the yielding lasts long enough that the GC collects in between, I am
getting a segfault because the exception used in the unwind process has been
collected.

I don't have direct prove that that is happening, but I have several
indicators:

* It does not happen with GC.disable()
* I put printouts in the Exception d'tor and sure enough I see a bunch of
exceptions collected shortly before the crash

Some more fiddling showed that this variation of the code does not show the
problem:

```
try { .. }
catch ( Exception e ) {} // literally empty
finally 
{
     /* code that yields the fiber for some time */
}
```

I tried to create a minimal test case but failed so far.

--
Apr 21 2016