Skip to content
This repository

Worker is stopped without restart #14

Closed
wangbin77 opened this Issue August 10, 2012 · 2 comments

3 participants

Devin Torres Andrew Thompson

For below code

handle_info({'DOWN', Ref, _, _, _}, StateName, State) ->
case ets:match(State#state.monitors, {'$1', Ref}) of
[[Pid]] ->
Sup = State#state.supervisor,
ok = supervisor:terminate_child(Sup, Pid),
{next_state, StateName, State};
[] ->
{next_state, StateName, State}
end;

If the current state is full, one worker is stopped and the state can't be changed. So even all workers are stopped, the state will always be kept as full.

It's unexpected.

What I think we can do here is check wether we can change the state and restart a new worker to handle the request in waiting list.

Andrew Thompson
Collaborator

I don't believe this is true, you get a DOWN message when a process 'holding' a worker dies, then we call terminate_child on the worker itself, which will send us an EXIT message for the worker. When that exit message is handled THEN the state is changed and a new worker spawned, if needed.

Or maybe you can provide some code or a test to illustrate the problem.

Andrew Thompson
Collaborator

Also, make sure you're running the latest version, I made some fixes this week that did resolve some state changing problems.

Devin Torres devinus closed this December 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.