Opened 14 years ago

Last modified 10 years ago

#218 assigned defect

Endless loop in atexit.c after loading a DLL

Reported by: dmik Owned by: bird
Priority: normal Milestone:
Component: libc Version: 0.6
Severity: normal Keywords: atexit
Cc:

Description

Here is what happens:

  1. An application declares a local static object inside the function.
  2. When the function is called for the first time, the constructor of this object is called which loads a DLL with DosLoadModule?().
  3. After calling the object's constructor, C++ runtime tries to add its destructor to the atexit list with _std_atexit().
  4. _std_atexit() calls libc_atexit_new() which spins indefinitely in its for() loop.

Note that this happens to the debug build of /branches/libc-0.6, haven't tried the release build so far.

Also note that if I remove the DLL that is being loaded (so that it cannot be found and DosLoadModule?() fails) the problem doesn't show up. As an assumption, the loaded DLL (which is also kLIBC-based) messes up the atexit list somehow when it adds its static destructors in DLL_InitTerm().

Another observation is that an attempt to exit the spin by pressing Ctrl-C causes a similar spin to happen in the for loop of the libc_atexit_unload() function.

Change History (4)

comment:1 Changed 13 years ago by bird

Milestone: libc-0.6.4

comment:2 Changed 13 years ago by bird

Keywords: atexit added
Status: newassigned

comment:3 Changed 12 years ago by bird

Milestone: libc-0.6.5libc-0.6.6

comment:4 Changed 10 years ago by Yuri Dario

Milestone: libc-0.6.6
Note: See TracTickets for help on using tickets.