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

Improve handling of poolboy timeouts during ping requests #763

Merged
merged 1 commit into from
Jan 3, 2014

Conversation

kellymclaughlin
Copy link
Contributor

The design of the riak_cs_wm_ping webmachine resource is that it blocks for a
timeout period while attempting to checkout a Riak connection from the poolboy
request_pool. If the timeout expires before a pool connection is checked out
it is designed to attempt to establish a direct connection to Riak and then
attempt the ping.

The reality of what occurs is that the process handling the ping request
crashes after the timeout expires. This is due to the fact that
poolboy:checkout calls gen_fsm:sync_send_event with a timeout parameter
specified. The timeout expiration results in a call to exit(timeout) that
causes the request process to crash and return a 500 error to the client.

This change modifies the riak_cs_wm_ping resource to catch the exit on timeout
and return the atom full. This allows the direct connection logic to execute
and either return success to the user or a 503 error indicating the system is
too heavily loaded.

The design of the riak_cs_wm_ping webmachine resource is that it
blocks for a timeout period while attempting to checkout a Riak
connection from the poolboy request_pool. If the timeout expires
before a pool connection is checked out it is designed to attempt to
establish a direct connection to Riak and then attempt the ping.

The reality of what occurs is that the process handling the ping request
crashes after the timeout expires. This is due to the fact that
poolboy:checkout calls gen_fsm:sync_send_event with a timeout
parameter specified. The timeout expiration results in a call to
exit(timeout) that causes the request process to crash and return a
500 error to the client.

This change modifies the riak_cs_wm_ping resource to catch the exit on
timeout and return the atom full. This allows the direct connection
logic to execute and either return success to the user or a 503 error
indicating the system is too heavily loaded.
@reiddraper
Copy link
Contributor

+1

@kellymclaughlin kellymclaughlin merged commit 707b15a into develop Jan 3, 2014
@kellymclaughlin kellymclaughlin deleted the bugfix/ping-timeout-handling branch January 3, 2014 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants