Jordan Brown (Sun) wrote: >> You might still be OK: If those libraries are reentrant (i.e. don't >> use static data), then it might be safe to have multiple copies loaded >> (though the bloat and confusion >> is certainly not a selling point). This might not be an easy thing for >> you to evaluate though. > > That wouldn't meet our needs. Our goal is to *not* use our private > copies of the libraries when there are public copies available.
Note, there have been numerous instances of applications loading multiple objects (of the same name) along the lines you describe. Most often this turns out to be simply wasteful, but not problematic. Because of the default symbol search, the first instance of the dependency is bound to, and the second instance is just left "dangling". Problems start occurring if the instances are brought in with different dlopen() calls, or use of flags like RTLD_GROUP. These can cause symbol resolution to be "confined" to a family of objects, and can result in binding to the two different instances (bad if the library maintains state and believes it is the only instance within a process - ie. having two different versions of libc.so.1 is going to be bad :-). Or, if the library runs .init code, then you might have two instances of the same .init being called. You can carry out some inspection with LD_DEBUG=unused. After each family of objects are loaded, ld.so.1 will tell you if any objects haven't been used - meaning, no bindings have occurred to the objects. If your private libraries show up as unused, then they've just been wastefully loaded, but might not cause any adverse affects. This observation probably isn't something you should design to, but might provide some "temporary relief" :-) Also note, there's a technology becoming more prevalent: direct binding. This is designed to provide for multiple objects to bind to explicit components. ie. you could have two callers of libfoo.so, that want two different instances, directly bind to the instances they want. Bought to you by the purveyors of vast quantities of rope. -- Rod.