-
Notifications
You must be signed in to change notification settings - Fork 453
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
interleave read and write on pipelined_get (#776, #941) #942
base: main
Are you sure you want to change the base?
Conversation
350d7b4
to
03ad88e
Compare
There's a bit of "devil in the details", but directionally this looks correct. Thanks for drafting @marvinthepa . With a little back and forth we can almost certainly get this in. |
Happy to give back and spend some company time on a library we have been using for a few years now.. |
03ad88e
to
dac656d
Compare
dac656d
to
1030225
Compare
427f027
to
6493f3d
Compare
@petergoldstein sorry for not following up on this PR for so long, but I found some time and hope I can manage to get this ready to integrate in the next weeks. I rebased on main, fixing the conflicts with especially #963 - so maybe if @casperisfine could check this PR as well it would be highly appreciated. I am still not 100% confident if the error handling is completely correct, but I was not able to find a flaw (at least not one that did not exist before anyway) after some time searching for one. |
fixes petergoldstein#776. fixes petergoldstein#941. When reading a large number of keys, memcached starts sending the response when dalli is not yet finished sending the request. As we did not start reading the response until we were finished writing the request, this could lead to the following problem: * the receive buffer (rcvbuf) would fill up * due to TCP backpressure, memcached would stop sending (okay as we are not reading anyway), but also stop reading * the send buffer (sndbuf) would also fill up * as we were using a blocking write without timeout, we would block forever (at least with ruby < 3.2, which introduces IO::Timeout, see petergoldstein#967) This is addressed by using IO::select on the sockets for both read and write, and thus start reading as soon as data is available.
6493f3d
to
f20883f
Compare
Back to draft, as I think I found a problem relating to #963, where the connection is unnecessarily closed during a pipelined get. sigh. |
fixes #776.
fixes #941.
When reading a large number of keys, memcached starts sending the
response when dalli is not yet finished sending the request.
As we did not start reading the response until we were finished writing
the request, this could lead to the following problem:
not reading anyway), but also stop reading
forever (at least with ruby < 3.2, which introduces IO::Timeout, see
IO::TimeoutError exceptions are not handled, breaking automatic retry #967)
This is addressed by using IO::select on the sockets for both read and
write, and thus start reading as soon as data is available.