ECN-4715 Problem closing loaded objects that contain the atexit() function

Defect Number: 57053

Product: ACUCOBOL-GT

Module: Runtime

Machines Affected: UNIX

Known Versions Affected: All

DESCRIPTION:

Upon shutdown, most UNIX runtimes call the dlclose() function on objects that have been loaded. However, when an object being closed has registered a function with atexit() this sometimes caused a crash in exit() because the object was no longer available to the process.

Some UNIX runtimes, such as Linux and Solaris, call the functions registered with atexit() just before the object is closed, thus avoiding this problem. Other runtimes such as AIX, HP-UX, and FreeBSD, do not.

To correct this problem on UNIX runtimes on which it occurs, this release includes a new configuration variable, CLOSE_LOADED_OBJECTS. The default is value is 1 on the systems that can do this safely and 0 on those that cannot.

If you want loaded objects to be closed during runtime shutdown, you can set the value to 1 on any system. However, this could cause a crash if the object has registered an atexit() function.