Ruby code on NFS mount, using another file on same mount causes problems

mountnasnfsrubywebrick

I'm working on an embedded system whoose details are explained at the end of this post. Tools are ruby on linux.

I put my ruby code on a remote NAS device on network and mount it to the embedded system I'm working on using NFS v3. My project scenario is like this: there is an all-in-one auto starter which 1.mounts the nfs share, 2. starts the webrick ruby code on mounted dir, 3. starts some other biz-logic related ruby code again on mounted dir, 4. starts a ruby code on local file system which does some basic logging and stuff…
I put each step in a loop that will retry when a start operation fails (start operations are made by system 'ruby XXXX' or popen3 calls). Here's what happens when I run this starter: step1 goes ok, step 2 fails, step 3 fails, step 4 goes ok, then step2 and 3 are retried and both starts ok too allways at second trial(I want to add that started codes are independent so; it doesnt matter which one starts first and changing the start order didnt make any difference).

I have inspected this problem and found out it also happens when I start things manually from shell and filtered it down to this: My webrick code loads .rb files that are at the same directory as itself and has some FileHandlers using the subdirs in NFS mount and my biz-logic also loads .rb files from nfs mount. And this, I believe, is the source of my problem (I have tried to load those files using both absolute paths like '/mnt/myMount/myLib.rb' and File.Join which both didnt make any difference).

Also, the webrick filehandlers too act pretty strange in this scenario, they always fail at first request of a file and then succeeds at the second request, no matter the file size.

To sum up, as the title says, when a Ruby code on NFS mount uses another file on same mount, ruby gives an EIO (Input Output Error).
I was able to reproduce this problem using simple .rb files (that just print itselves filename) loading each other as explained in the above scenario on my environment (though I havent tried this on a regular PC).
How can I solve this, is it about the paths given to load/require methods or what?

My working envrionment: The device I'm working with is an intelligent RFID reader, with an embedded linux arm based computer on-board. The only api/language manufacturer allows and provides (w/o getting out of license terms) is ruby, and they give no-support for installing extra-stuff and they have customized the kernel in device to make installing/compiling anything as hard as possible. I can use extra ruby stuff if they're just .rb lib files that is I can easily just include them in my code, but anything that requires compiling is a no-no. Also, this system does not have gem.

Best Answer

I've had trouble with NFS mounted files before, too. MAybe could ask core. Until then perhaps retry when you encounter the error you do? GL. -r

Related Topic