[1.7.0-60] crash on exit on c++ program (octave)

Dave Korn dave.korn.cygwin@googlemail.com
Thu Aug 20 19:58:00 GMT 2009

Dave Korn wrote:
> Marco Atzeri wrote:
>> Hi,
>> I was building the latest octave-3.2.2 on cygwin-1.7.0-60
>> and I found that the program crash on exit.
>> A single command "exit" is enough to core dump the program; for the rest it is working as expected and pass all the build test.
>> Also the previous octave-3.2.0 that I build/released 
>> on 29th June (probably 1.7.0-50 time) is crashing with 
>> cygwin 1.7.0-60. 
>> Testing previous cygwin versions I found that octave-3.2.0
>> works fine with 1.7.0-52 and crashes with 1.7.0-56. 
>> Could Dave's change mentioned here
>> http://cygwin.com/snapshots/winsup-changelog-20090724-20090801
>> be the cause ?
>   The problem is related to termination sequence.  octave calls dlclose() for
> all the modules it loads, from octave_dld_function::~octave_dld_function() at
> shutdown time.  The modules in question have already had their dtors run, and
> dlclose() causes them to be run a second time.
>   We should probably make running the dtors idempotent, or unlink each dll
> from the dll_list as we go.  I need to think about this for a little while,
> more later.

  The solution could be as simple as this.  Just don't call dtors for dlopen'd
DLLs when we run the global dll dtors.  If the application dlcloses them,
their dtors get run then.  If it doesn't, they'll be run much later when the
dlopen'd module receives DLL_PROCESS_DETACH as everything is being closed.
Only thing I'm wondering about is if we shouldn't forcibly dlclose any
left-over modules as part of the dtors sequence so that they run before the
newlib i/o shutdown.  Anyone got an opinion?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlclose-vs-dtors.diff
Type: text/x-c
Size: 632 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20090820/96bd008e/attachment.bin>

More information about the Cygwin-developers mailing list