Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Dec 18 '12 at 13:20

This question came from our site for professional and enthusiast programmers.

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... –  Ignacio Vazquez-Abrams 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
add comment

2 Answers 2

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.