shashank created CAMEL-27566:
--------------------------------
Summary: camel-file - FileLockClusterView: a member that lost the
leadership and failed one attempt to take it back backs off for good, so a
cluster with no other member stays without a leader
Key: CAMEL-27566
URL: https://issues.apache.org/jira/browse/CAMEL-27566
Project: Camel
Issue Type: Bug
Components: camel-file
Reporter: shashank
Assignee: shashank
h3. What happens
When the leader's read or write of the cluster data fails once, the leader
gives up the leadership and releases the lock. The data file still holds its
id. In the next check the member reads its own id and tries to take the
leadership back at once. If that attempt fails too (any timeout or I/O error
while it opens or resolves the lock file), the member keeps its own id as the
previous observation. From then on every check finds its own id in both the
previous and the latest observation and takes the "Backoff so the current
cluster leader can notice leadership is relinquished" return in {{tryLock}}.
Only a leader writes the data file, so nothing ever changes it, and the backoff
never ends.
With another live member, that member finds the heartbeat stale and takes over.
With a single member, or when the other members are stopped, nobody is leader
again until a restart, although the file system is healthy again.
{{singleClusterMemberRecoversLeadershipIfLockFileDeleted}} in camel-master
shows that a single member is meant to recover.
h3. How to reproduce
One {{FileLockClusterService}} on a local directory. One failed read of the
cluster data by the leader, then a failure of every attempt of the task that
resolves the lock file path in the first attempt to take the leadership back.
After that the file system is healthy: in 5 seconds (50 checks at a 100 ms
interval) the member never tries the lock again. With only the failed read, it
takes the leadership back at once.
Found with a TLA+ model of the file lock cluster view (liveness: if failures
stop, some member is eventually leader for good).
h3. Fix
The backoff lasts one check: when the member backs off, it forgets the
observation of its own id, so the next check tries the lock again. The backoff
still gives a member that has just taken the lock one interval to write its id.
A member whose attempts keep failing now tries every second check, and the OS
lock decides.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)