1

I am using Red Hat Enterprise Linux Server release 5.7 (Tikanga).

When I change LD_LIBRARY_PATH, the system becomes very slow for every command (except for shell builtins like cd)

For example, ls in empty directory takes around 1 second. When I change LD_LIBRARY_PATH back to the default, all looks ok.

The LD_LIBRARY_PATH I added is not especially long (10-11 directories.)

I tried to set LD_DEBUG=all , but couldnt find anything suspicious.

I checked all FS which I added in PATH have normal performance.

Please tell me what else I should check and what might be the reason for the slowdown.

4
  • 1
    Run the commands with strace, and see what's happening.
    – nos
    Dec 17 '12 at 22:41
  • 1 second in an empty directory is too much, no matter the LD_LIBRARY_PATH... Anyway you can try running strace on it.
    – rodrigo
    Dec 17 '12 at 22:42
  • 10-11? Holy cow, that's a lot of directories... Dec 18 '12 at 1:13
  • Perhaps you could add some paths to the /etc/ld.so.conf and run ldconfig to rebuild the cache?
    – Brett Hale
    Dec 18 '12 at 5:52
1

The LD_LIBRARY_PATH can be used to override things. Thus, when any executable (e.g. ls) needs something common like libc, it is going to have to scan all of the folders from the env. variable before it can look in the "normal" locations. With ldconfig, I believe the system is able to cache the list of libraries for quick lookup. With the env variable, it has to rescan every time (the var could change).

It seems that the grand total of files to be scanned is perhaps rather large. Try timing an ls of all of the directories combined.

0

I found the Issue , One NFS which was in LD_LIBRARY_PATH was not behaving good at times. So, Search on single directory there was taking .01 seconds there which was adding up per library and path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.