allthingssecurity commented on PR #30576:
URL: https://github.com/apache/camel/pull/30576#issuecomment-7076430481
Thanks Claus. Thanks for the rebase too: the follow-up is on top of it, in
73eba9910425.
1. `toRealPath()` on the check thread: `lockPathKey()` now resolves the key
through `clusterTaskExecutor.run(ThrowingHelper.wrapAsSupplier(...))`, the same
wrapper as `createRandomAccessFile`, so it uses the cluster data task timeout
and attempts. It runs before `putIfAbsent`, so a timeout leaves nothing
registered, and `tryLock` schedules the next check as it does for the other I/O
failures. The direct call was worse than it looked: it ran on the single
scheduler thread of the service, so a hang also stopped the checks of the other
views of that service (other namespaces), including their leader heartbeats.
I picked this over resolving once per start because the directory may not
exist yet when the view starts (`createDirectories` in `doStart` can fail, for
example while the mount is not up). The key would then stay unresolved for the
whole start while another view resolves the real path, and with two different
keys the guard is lost. At each attempt the key is resolved right after
`createClusterRootDirectoryIfRequired`, so the directory is there. This also
keeps another unguarded file call out of `doStart`. The conditional
`remove(key, this)` and the write of the `lockPathKey` field under `stateLock`
are unchanged.
One more change came out of our review of this: the old fallback to the
unresolved path on an `IOException` could also give a key that differs from the
key of another view (a transient NFS error with a symlinked root, for example).
`resolveLockPathKey()` now lets the exception fail the attempt instead. Opening
the lock file fails without the directory anyway, so nothing is lost.
Two new tests in `FileLockClusterViewSameJvmTest`:
`leadershipCheckGoesOnWhileResolvingTheLockPathHangs` (each check times out
after 200 ms and the next is scheduled, and the view takes the lock once the
key resolves, so nothing was left registered) and
`lockFileIsNotOpenedWhileTheKeyCannotBeResolved`. Both fail against the
behaviour of the first commit and pass with the change. The file cluster tests
of camel-file and camel-core and the camel-master tests pass, and the class ran
20 times in one JVM: 80 runs, 0 failures. The PR description is updated.
2. Case-insensitive file systems: agreed, left as is.
_Claude Code on behalf of allthingssecurity_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]