[Tarantool-patches] [PATCH 1/1] raft: fix crash in worker fiber

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Nov 8 21:04:09 MSK 2020


> diff --git a/src/box/raft.c b/src/box/raft.c
> index e1e60ce94..914b0d68f 100644
> --- a/src/box/raft.c
> +++ b/src/box/raft.c
> @@ -682,11 +682,11 @@ raft_worker_f(va_list args)
>  			raft_worker_handle_broadcast();
>  			is_idle = false;
>  		}
> +		if (is_idle) {
> +			assert(raft_is_fully_on_disk());
> +			fiber_yield();
> +		}
>  		fiber_sleep(0);
> -		if (!is_idle)
> -			continue;
> -		assert(raft_is_fully_on_disk());
> -		fiber_yield();
>  	}
>  	return 0;

I changed this part just a little. Because it makes no sense to
sleep(0) right after a yield. Force pushed to the branch.

====================
@@ -685,8 +685,9 @@ raft_worker_f(va_list args)
 		if (is_idle) {
 			assert(raft_is_fully_on_disk());
 			fiber_yield();
+		} else {
+			fiber_sleep(0);
 		}
-		fiber_sleep(0);
 	}
 	return 0;
 }


More information about the Tarantool-patches mailing list