Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote file-check problem... #1

Open
omeletteo opened this issue Jul 30, 2013 · 1 comment
Open

Remote file-check problem... #1

omeletteo opened this issue Jul 30, 2013 · 1 comment

Comments

@omeletteo
Copy link

Hi. I have just installed your script on Ubuntu 10.04 and it works! A little problem though - having checked that the remote file-check is working properly, (by running the script from the terminal as you suggest) whenever a file transfer is in progress and the script does its file-check, it apparently cannot validate that it is present and disconnects the share, which in turn results in the file transfer being terminated with an error. When no transfer is taking place, the share is never disconnected.

Any way around this that doesn't involve disabling the remote file-check?

Edit: Actually my 2'nd attempt, the first edit didn't 'stick' apparently!

I have noticed that files sent to the remote also cause nfs_automount to disconnect the share, but more worryingly, the OS will not generate a file-transfer error - eg. sending 4 large 300meg files named 'file_1' -> 'file_4', perhaps only 'file_1' and 'file_4' end up on the remote computer! Linux seems to just cache the 'unsent' files, not noticing that the share no longer exists. nfs_automount will then 'rediscover' the remote file and reconnect the share, so resulting in some of the files being skipped.

Files received from the remote will always cause Linux to terminate with a file-transfer error when nfs_automount disconnects the share.

Edit2: Ok, I just realised that the 'unsent' files are just being copied locally to the folder where the remote share has been mounted. Makes sense.

@omeletteo
Copy link
Author

Hello again. Re-reading my above post I noticed that I don't explicitly state the issue I'm having with your script. So specifically, when sending or receiving very large files over the network - I regularly transfer WAV's of 200-300meg - your script finds the remote share "unreachable" most but not all of the time, and will unmount the share during a file-transfer.

With regular-sized files it seems to work fine, so there is obviously a 'time-out' due to file-size involved. Well I've being playing with this quite a bit and provide the following 'semi-solution'. Or would if there was a way of attaching code here?!?!?!? Anyway, below is the function I'm using to monitor network traffic, but also (and first) the variables that need to be declared first. Note that 'IF' is 'hard-coded' below but really needs to be set 'programmatically' - which I couldn't figure out how to do! Basically I just disable unmounting during high network traffic.

All said and done, I'm finding NFS pretty much impossible to work with! My 'remote server' I switch off at the end of the day, whereas my client is left running 24/7. What I've found several days in a row now is that when I restart my server next day, nfs_automount will detect it & reconnect perfectly, but when I try transferring files, the connection will hang! I'm then left with a load of Nautilus zombies & a dead NFS share, necessitating a system restart - as a relaunched Nautilus cannot access the share, so another instance hangs, while nfs_automount will also have hung while checking the share. The fact that there seems to be no way of resetting the client-side of NFS short of a system restart is in my eyes almost criminal. All the more bizarre is the fact that its developers seem to have intentionally removed this functionality when they removed 'nfs-common' from the setup - or at least that is my take on things from what I've been able to find on the net. Over the past 7 years that I've been using Linux, I've found that NFS to be its biggest Achilles Heel - it's like development on it stopped back in the 90's. No wonder Samba is so popular in comparison.

IF="wlan0" # this really need to be set 'programmatically' - how?
RXPREV=-1
TXPREV=-1
RXMAXBW=0
TXMAXBW=0
BWRX=0
BWTX=0

function check_transferinprogress { # BFLG set 'true' if network busy, otherwise 'false'

RX=cat /sys/class/net/${IF}/statistics/rx_bytes
TX=cat /sys/class/net/${IF}/statistics/tx_bytes

if [ $RXPREV -ne -1 ] ; then
let BWRX=$RX-$RXPREV
let BWTX=$TX-$TXPREV
fi
let RXPREV=$RX # set here to check against 4/5 of highest measured bandwidth, but
let TXPREV=$TX # too many false-positives, so probably needs to be 2/3 -> 1/2
if [ $BWRX -gt $((RXMAXBW-RXMAXBW/5)) ] || [ $BWTX -gt $((TXMAXBW-TXMAXBW/5)) ] ; then
BFLG=true
else
BFLG=false
fi
if [ $BWRX -gt $RXMAXBW ] ; then
let RXMAXBW=$BWRX
fi
if [ $BWTX -gt $TXMAXBW ] ; then
let TXMAXBW=$BWTX
fi
echo 'RX Max BW = '$((RXMAXBW/INTERVAL))'B/s TX Max BW = '$((TXMAXBW/INTERVAL))'B/s Current BW = ('$((BWRX/INTERVAL)) $((BWTX/INTERVAL))')'
}

@omeletteo omeletteo reopened this Aug 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant