Opened 15 years ago
Last modified 11 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:
- An application declares a local static object inside the function.
- When the function is called for the first time, the constructor of this object is called which loads a DLL with DosLoadModule().
- After calling the object's constructor, C++ runtime tries to add its destructor to the atexit list with _std_atexit().
- _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 by , 14 years ago
Milestone: | → libc-0.6.4 |
---|
comment:2 by , 14 years ago
Keywords: | atexit added |
---|---|
Status: | new → assigned |
comment:3 by , 13 years ago
Milestone: | libc-0.6.5 → libc-0.6.6 |
---|
comment:4 by , 11 years ago
Milestone: | libc-0.6.6 |
---|