fix(cluster): ensure only VIP holder pushes sync and prevent deadlocks with flock and strict VIP check

This commit is contained in:
sorcier committed 2026-11-05 23:41:54 +01:00
1 parent 0b740da87e
commit 0b654c885c
3 files changed
+14 -9

No files matched your search

+3 -2
View File
@@ -203,12 +203,13 @@ class ClusterManager
*/
public function isVirtualIpActive(string $vip): bool
{
if ($vip === '') {
$cleanVip = explode('/', trim($vip))[0] ?? '';
if ($cleanVip === '') {
return false;
}
$output = shell_exec('ip -o -4 addr show 2>/dev/null') ?: '';
foreach (preg_split('/\r?\n/', $output) ?: [] as $line) {
if (preg_match('/\sinet\s+' . preg_quote($vip, '/') . '\//', $line)) {
if (preg_match('/\sinet\s+' . preg_quote($cleanVip, '/') . '(\/|\s)/', $line)) {
return true;
}
}