From ea05b1305fb9f4682d9ba82a30f44be0fc0a8bca Mon Sep 17 00:00:00 2001 From: John Date: Tue, 28 Apr 2020 13:09:10 +0200 Subject: [PATCH 1/2] Fix typo in worker_pool_pulse (prevented compilation) --- eqc/worker_pool_pulse.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eqc/worker_pool_pulse.erl b/eqc/worker_pool_pulse.erl index 95a5cbe62..e67053157 100644 --- a/eqc/worker_pool_pulse.erl +++ b/eqc/worker_pool_pulse.erl @@ -59,7 +59,7 @@ handle_work(Work, _From, State) -> %% @doc Any amount of work should complete through any size pool. prop_any_pool() -> - ?SETUP(fun setup_and_teardown/1, + ?SETUP(fun setup_and_teardown/0, ?FORALL({Seed, ExtraWork, WorkList}, {pulse:seed(), frequency([{10,true},{1,false}]), From 0d5214884bbaed3850465d8ff7a72af392231096 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 28 Apr 2020 13:10:08 +0200 Subject: [PATCH 2/2] [riak_core_worker_pool] Fix deadlock caused by poolboy restarting a crashed worker while the pool is in the queueing state with an empty queue. --- src/riak_core_worker_pool.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/riak_core_worker_pool.erl b/src/riak_core_worker_pool.erl index 94f7c8280..240c8e729 100644 --- a/src/riak_core_worker_pool.erl +++ b/src/riak_core_worker_pool.erl @@ -173,8 +173,14 @@ handle_event(worker_start, StateName, #state{pool=Pool, queue=Q, monitors=Monito {next_state, queueing, State#state{queue=Rem, monitors=NewMonitors}} end; {empty, _} -> - %% StateName might be either 'ready' or 'shutdown' - {next_state, StateName, State} + {next_state, + %% If we are in state queueing with nothing in the queue, + %% move to the ready state so that the next incoming job + %% checks out the new worker from poolboy. + if StateName==queueing -> ready; + true -> StateName + end, + State} end; handle_event(_Event, StateName, State) -> {next_state, StateName, State}.