This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dll_list::detach() can stackdump


I'm trying to debug a dll_list::detach() stackdump problem that I first
triggered by a Cygwin Perl application.  Specifically, the problem
occurs at the following dll_init.cc line:

    void
    dll_list::detach (dll *d)
    {
        ...
***>    if (d->count <= 0)
        ...
    }

Note that I can only reproduce this problem on one Cygwin installation
so far.  FWIW, this is a partial installation (i.e., not all packages
installed) with all standard Cygwin DLLs (except for the Cygwin DLL
itself) rebased.  However, all extra CPAN Perl extension module DLLs are
not rebased due to an oversight.

The first attachment is the a minimal Perl application that can also
trigger the problem, the second is a C version.  It appears that
dlopen()-ing "many" DLLs (some rebased, some not) and then forking
(two-levels) can trigger the problem.

The third attachment is a patch (in a very loose sense of the word) that
"fixes" the problem and adds some (hopefully) useful annotations:

  ...
  284 5197991 [main] perl 620! dll_list::detach: JLT: myself->process_state = C1
  422 5198413 [main] perl 620! dll_list::detach: JLT: d = 0xB20000
  340 5198753 [main] perl 620! dll_list::detach: JLT: VirtualFree(d = 0xB20000, d->name = c:\Program Files\Hewlett-Packard\SANmaster\usr\lib\perl5\5.8.0\cygwin-multi-64int\auto\Socket\Socket.dll)
  489 5199242 [main] perl 620! dll_list::detach: JLT: loaded_dlls = 5

*>860 5200102 [main] perl 620! dll_list::detach: JLT: skipping bad d = 0xB00000

  440 5200542 [main] perl 620! dll_list::detach: JLT: myself->process_state = C1
  414 5200956 [main] perl 620! dll_list::detach: JLT: d = 0x67F70000
  431 5201387 [main] perl 620! dll_list::detach: JLT: VirtualFree(d = 0x67F70000, d->name = c:\cygwin\bin\cygexpat-0.dll)
  339 5201726 [main] perl 620! dll_list::detach: JLT: loaded_dlls = 4
  ...

The above seems to imply that a bad address is passed into
cygwin_detach_dll() for one of the DLLs.  Unfortunately, I don't
understand why.  FWIW, in this case, the skipped DLL is the CPAN
XML::Parser's Expat.dll which was not rebased.

Any hints on how to debug this further is greatly appreciated.

Thanks,
Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Attachment: stack.pl
Description: Perl program

Attachment: dll.cc
Description: Text document

Attachment: dll_init.cc.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]