FreeServerFromClusterJob keeps rewiring cluster
Not sure how I got into this state, but it is a state we need to handle. My computer goes to sleep and I think if it is asleep longer than the license timeout, the license gets released. The problem is that my server still shows that has a license. See image below:

For some reason, the server never picks a license from the repo and this forces the FreeServerFromClusterJob to run and rewire the cluster every minute.
see: https://gist.github.com/wezell/49488e0bf28dabbc3db6bc7c38b1bd2d
So here are my thoughts on this - I believe that this happens when my computer wakes up from a 30m sleep, the dotCMS runs the quartz jobs whose firing times were missed. My thinking is that the FreeServerFromClusterJob ran before the ServerHeartbeatJob which means that my server was removed from the cluster_server* and sitelic tables as a dead server BEFORE the it could write the heartbeat. When the heartbeat job ran, there was no server in the cluster_server table to register uptime for. Seems like these two jobs need to be combined to insure a consistent order.
Other thoughts:
-
We have two places where we store a heartbeat. In the
cluster_server_uptimetable and in thesitelictable. We do not need both of these. I'd like to remove the redundantcluster_server_uptimetable completely and just use thesitelic.lastpingcolumn. -
The
FreeServerFromClusterJobis stateful so it is only getting run by one server in a cluster. If the other servers in the cluster need to rewire as well, they definitely will not do so.
PR master: https://github.com/dotCMS/core/pull/12979 PR 2 ee: https://github.com/dotCMS/enterprise-2.x/pull/551 PR 3 ee: https://github.com/dotCMS/enterprise-2.x/pull/552
Waiting for fix on https://github.com/dotCMS/core/issues/13018 to complete testing