public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH cluster] corosync.conf sync: reload after sleep
@ 2022-07-07  8:21 Fabian Grünbichler
  2022-07-07  9:38 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2022-07-07  8:21 UTC (permalink / raw)
  To: pve-devel

if processing a corosync.conf update is delayed on a single node,
reloading the config too early can have disastrous results (loss of
token and HA fence). artifically delay the reload command by one second
to allow update propagation in most scenarios until a proper solution
(e.g., using broadcasting/querying of locally deployed config versions)
has been developed and fully tested.

reported on the forum:
https://forum.proxmox.com/threads/expanding-cluster-reboots-all-vms.110903/

reported issue can be reproduced by deploying a patched pmxcfs on
non-reloading node that sleeps before writing out a broadcasted
corosync.conf update and adding a node to the cluster, leading to the
following sequence of events:

- corosync config reload command received
- corosync config update written out

which causes that particular node to have a different view of cluster
topology, causing all corosync communication to fail for all nodes until
corosync on the affected node is restarted (the on-disk config is
correct after all, just not in effect).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
tested new cluster creation from scratch, and cluster expansion (on a
test PVE cluster with HA enabled and running guests, to simulate some
load).

 data/src/dcdb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/data/src/dcdb.c b/data/src/dcdb.c
index b690355..58351ed 100644
--- a/data/src/dcdb.c
+++ b/data/src/dcdb.c
@@ -410,6 +410,12 @@ dcdb_sync_corosync_conf(
 		    HOST_CLUSTER_CONF_FN, new_version);
 	
 	if (notify_corosync && old_version) {
+		/*
+		 * sleep for 1s to hopefully allow new config to propagate
+		 * FIXME: actually query the status somehow?
+		 */
+		sleep(1);
+
 		/* tell corosync that there is a new config file */
 		cfs_debug ("run corosync-cfgtool -R");
 		int status = system("corosync-cfgtool -R >/dev/null 2>&1");
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: Re: [PATCH cluster] corosync.conf sync: reload after sleep
  2022-07-07  8:21 [pve-devel] [PATCH cluster] corosync.conf sync: reload after sleep Fabian Grünbichler
@ 2022-07-07  9:38 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-07-07  9:38 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler

On 07/07/2022 10:21, Fabian Grünbichler wrote:
> if processing a corosync.conf update is delayed on a single node,
> reloading the config too early can have disastrous results (loss of
> token and HA fence). artifically delay the reload command by one second
> to allow update propagation in most scenarios until a proper solution
> (e.g., using broadcasting/querying of locally deployed config versions)
> has been developed and fully tested.
> 
> reported on the forum:
> https://forum.proxmox.com/threads/expanding-cluster-reboots-all-vms.110903/
> 
> reported issue can be reproduced by deploying a patched pmxcfs on
> non-reloading node that sleeps before writing out a broadcasted
> corosync.conf update and adding a node to the cluster, leading to the
> following sequence of events:
> 
> - corosync config reload command received
> - corosync config update written out
> 
> which causes that particular node to have a different view of cluster
> topology, causing all corosync communication to fail for all nodes until
> corosync on the affected node is restarted (the on-disk config is
> correct after all, just not in effect).
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> tested new cluster creation from scratch, and cluster expansion (on a
> test PVE cluster with HA enabled and running guests, to simulate some
> load).
> 
>  data/src/dcdb.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
>

applied, thanks!

for now the simplest stop gap, any more elaborate mechanism may be better
suited for a major release anyway, upgrade-wise.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-07  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07  8:21 [pve-devel] [PATCH cluster] corosync.conf sync: reload after sleep Fabian Grünbichler
2022-07-07  9:38 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal