3

I am experiencing some very weird behaviour regarding the loading of a shared library from an NFS4 mount, and am hoping someone can shed light on it.

Consider the following:

$ ucto
ucto: error while loading shared libraries: libfolia.so.3: cannot open shared object file: No such file or directory

Upon investigation I see no reason this error should appear:

$ which ucto
 /vol/customopt/lamachine/bin/ucto

$ echo $LD_LIBRARY_PATH
 /vol/customopt/lamachine/lib:/vol/customopt/machine-translation/lib:/vol/customopt/nlptools/lib/:

$ ls -lh /vol/customopt/lamachine/lib/libfolia.so.3*
 lrwxrwxrwx 1 proycon customopt 17 Sep 18 16:42 /vol/customopt/lamachine/lib/libfolia.so.3 -> libfolia.so.3.0.1
 -rwxr-xr-x 1 proycon customopt 9.5M Sep 18 16:42 /vol/customopt/lamachine/lib/libfolia.so.3.0.1

I verified I can open the library file without issues.

Now when I switch to another host that uses the very same NFS mount, I have no trouble whatsoever and the library is found and loaded without issue.

The mount is mounted as follows:

 customopt-srv.mydomain.com:/export/customopt on /vol/customopt type nfs (rw,nosuid,tcp,hard,intr,sloppy,vers=4)

What is going on here? Is there some caching I'm unaware of? Has anybody experienced similar issues? Should I look client-side or server-side?

Both clients and servers are running Ubuntu 14.04 LTS.

2
  • Update: After waiting a while, it suddenly does again work on the affected host. It's as if it for some reason takes a while after the library has been freshly compiled. Why?
    – proycon
    Commented Sep 24, 2015 at 12:28
  • Hypothesis: I suspect it has something to do with the fact that: 1) a process was already running using the shared-library 2) the shared-library was recompiled in the meantime 3) new processes suddenly can't find the library anymore (ldd -v also says not found whilst the file does exist) I'm still wondering whether it's related to NFS as I strongly suspect, and why it suddenly does work after a certain time. I still need a solution so this doesn't occur.
    – proycon
    Commented Sep 24, 2015 at 13:39

2 Answers 2

1

It sounds like your library cache (/etc/ld.so.cache) had not yet been updated on the client. Check the output of ldconfig -p next time the issue occurs to confirm.

1
  • Thank for the suggestion. The mount, however, refers to a custom location that is not part of the ld cache (should it be? I'm using $LD_LIBRARY_PATH). Things are working now (still don't know why), but none of these libs are in ldconfig -p.
    – proycon
    Commented Sep 24, 2015 at 12:55
0

NFS4 uses caching. If you add/modify/delete any file on the server the NFS4 cache on the clients will not notice that and will keep using the old file.

After some time the cached file gets invalidated because it is too old and a new lookup happens. At that point it "suddenly" works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .