Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for overflow worker start failure #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

juhlig
Copy link

@juhlig juhlig commented Mar 22, 2019

As described in #122, if an overflow worker was unable to start (which may always happen owing to circumstances), the poolboy gen_server would crash, because it invariably expects {ok, Pid} to be returned from supervisor:start_child/2 in the new_worker/1 function. That is even though the spec for the poolboy_worker:start_link/1 callback function explicitly allows {error, term()} to be returned.

This PR changes this in that it really allows error tuples to be returned from the worker start functions. If an overflow worker fails to start in response to a checkout or transaction request, an exit exception will be raised in the client instead. Failure to start a residual worker on pool start, or restart of an exited residual worker, will still cause a crash of the pool as before. I think that is what is to be expected, and it can be provided for when needed with the other PR (#123) that I recently submitted.

Fixes the issue that failure to start an overflow worker
in response to a checkout crashes a pool. Instead, this now
raises an exit exception in the client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant