dCache / nfs4j

Pure Java NFSv3 and NFSv4.2 implementation
Other
240 stars 76 forks source link

RENEW operation fails when lease has expired #37

Closed dkocher closed 4 years ago

dkocher commented 8 years ago

[OncRpcSvc Worker(6)] WARN org.dcache.nfs.v4.NFSServerV41 - Bad client: op: RENEW : NFS4ERR_EXPIRED : lease time expired: (32209908): 00000000b8e85600dffe1002cda07f00000100000000000000006475636b2d30002f55736572732f646b6f636865722f4c6962726172792f47726f757020436f6e7461696e6572732f473639534358393458552e6475636b2f4c6962726172792f4170706c69636174696f6e20537570706f72742f6475636b2f566f6c756d65732f64726f70626f782e697465726174652e636820e2809320576562444156202848545450532900 (6307675351287857153).

Not sure who is to blaim but when accessing with the server with the NFS client in OS X the client endlessly tries to send a RENEW operation but always gets an NFS4ERR_EXPIRED error returned when the default leas time has expired. It looks like the default lease time in NFSv4StateHandler cannot be configured.

kofemann commented 8 years ago

NFS4ERR_EXPIRED is returned, when client did not send RENEW within the leas time period. Can you provide a packet capture to see did server messed something or it's the client, who was lazy.

dkocher commented 8 years ago

The client was hibernated and has therefore not sent any RENEW within the lease time. When awaken from sleep and the network is again up the client resumes with sending requests.

dkocher commented 8 years ago

Would it be RFC compliant to update the latest timestamp in _cl_time regardless of the expiry, allowing subsequent RENEW requests to complete without failure?

kofemann commented 8 years ago

Client have to react on NFS4ERR_EXPIRED by establishing new clientid:

https://tools.ietf.org/html/rfc7530#section-9.6.3

Technically, we can't allow that as server has no idea is client temporary gone (hibernate or so) or crashed/permanently unavailable. RENEW is a heartbeat to tell server hat all allocated resource, including locks are still in use. Well, we might have some magic to keep the 'locks' as long as there are no conflicts, but we need to clean the, at some point.

I will prefer to ping apple to fix the client. First of all, it will make there client more robust, and second, it will be an indication that nfsv4.0 client in use (in many cases bug reports is the only indication of products being in use).

For now, you can bump the NFS4_LEASE_TIME to an bigger number, but, I think, it will not solve hibernate issue.

dkocher commented 4 years ago

I have filed FB7714367 with Apple as this is still reproducible on 10.15.4 (19E2269).

dkocher commented 4 years ago

It would be great if the _clientsByServerId would be made configurable that allows to workaround this with a custom implementation with leases not expiring.