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

add handler call on unmounts #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

willscott
Copy link
Owner

Allow handlers to correlate Mount and Unmount events to free resources like file handles when a client disconnects.

@willscott
Copy link
Owner Author

upon testing, it looks like the unmount RPC call is only made when the nfs session has authentication. In the null authentication that's mostly being used, the unmounting of the device may (at least for linux clients) only be signaled through the closing of the TCP connection.

@ozkatz
Copy link
Contributor

ozkatz commented Apr 7, 2024

Hey @willscott - thanks for this great library! How can I help in pushing this one past the finish line?

@willscott
Copy link
Owner Author

PR welcome :) - i think it's probably not as drafted here, but rather on seeing the network connection terminate

@ozkatz
Copy link
Contributor

ozkatz commented Apr 7, 2024

@willscott that's a good idea, but from my experience with TCP in Go, I don't know that there's a safe cross-platform way (looking at you, Windows!) to check TCP connection "liveness".

The only reliable way to tell if a connection is truly open, is to try to read from it (>0 bytes), which introduces its own set of complexities.

See recap of the problem on go-sql-driver/mysql 's attempt at the same.


Additionally, naive question regarding NFS implementations in the wild:

Will closing a TCP connection to a server necessarily mean explicit unmounting?

I can imagine an NFS client driver closing idle connections after a while of inactivity and reconnecting on demand when accessed by the user. Perhaps the connection tracks state that forbids this?

@willscott
Copy link
Owner Author

I think your concern is probably why there isn't a clear Unmount event that makes sense. The decision to unmount in a stateless protocol like NFS ends up being a hybrid between the server's policy on when to clean up state and clients signalling explicit disconnects.

I think there may be a useful event to raise to handlers on these explicit disconnects when they are signaled by clients, and that's probably what this should be, with the understanding that it won't be "complete"

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

Successfully merging this pull request may close these issues.

2 participants