basho / riak-erlang-client

The Riak client for Erlang.
Apache License 2.0
311 stars 188 forks source link

Request timers are started too early #155

Open reiddraper opened 10 years ago

reiddraper commented 10 years ago

riakc_pb_socket uses {active, once} to receive TCP data as messages. In order to support timeouts on reading this data, it also sends itself messages using erlang:send_after. Since only one request can be outstanding at once, concurrent requests are queued up, and processed FIFO. However, the timer for an individual request is started when the request is queued, not when it is actually sent to Riak. The problem is that we start the timer (send_after) inside of new_request, when this request might just be queued. This has two consequences:

This may actually be on purpose, but to me it conflates a TCP read timeout with an 'overall request' timeout, which would include time spent waiting in the queue.

reiddraper commented 10 years ago

@jonmeredith looks like you wrote this about four years ago. Any recollection whether it was designed this way on purpose?

seancribbs commented 10 years ago

@reiddraper Has this been adequately resolved by #156 and #160?