-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add support for CLIENT SETINFO
#2857
Conversation
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #2857 +/- ##
===========================================
+ Coverage 77.33% 90.91% +13.58%
===========================================
Files 126 126
Lines 32178 32384 +206
===========================================
+ Hits 24884 29443 +4559
+ Misses 7294 2941 -4353
☔ View full report in Codecov by Sentry. |
@kristjanvalur I'm digging through what I think is the initial issue (#2349) and subsequent PR (#2557), and the recent fix in #2859.. and to be honest, a bit flummoxed on why the test tests/test_asyncio/test_connection.py::test_connection_disconect_race[AsyncRESP2Parser] fails, and then cascades. It ends with a timeout issue - but there's something missing in my understanding. Can I talk you into having a look 🙏 ? I will continue to do so. |
Hi, sure, what does it have to do with this PR? Where are you seeing the behaviour you describe? |
So in theory it doesn't, which is why I'm flumoxxed. On connection we now call redis' identification commands (this is good!) and allow users to not do so should they choose. But, this test fails because we hit the 30s timeout - which was the purpose of the test. Further down the failure deck, everything fails due to what appears to be data in the async retrieval side. On the bright side the stack traces haven't been useful. Using this CI result as an example after the test fails, we eventually lead to read failures such as below - but honestly that's a red herring. The real issue is data being left in the reader.
To me, this spells out the need to properly reset the async side prior to each test, but that's another issue. |
Okay, I see. I will try to figure out what is going on. I was confused because a brief look at the failing tests didn't show me the issue you were speaking of. but clearly everything blows up. |
Ok, what is happening, is that the 30s timeout occurs as part of the test harness. The connect call fails, the test is aborted, but the coroutine running the test is never killed. i.e., this code:
never exits the context manager. This means that
i.e. we are hitting a hard timeout on select and there is nothing to catch it. For async, we need async timeouts. |
This test should not fail during connect, it is designed to test what happens during disconnect. But I need to find out why the test fails in this particular way, we should get a "nice" timeout which should ensure that the patching is undone. |
Ah, it is the "pytest_timeout". |
So, yes, we are timing out here: try:
# set the library name and version
await self.send_command("CLIENT", "SETINFO", "LIB-NAME", "redis-py")
await self.read_response()
await self.send_command("CLIENT", "SETINFO", "LIB-VER", get_lib_version())
await self.read_response()
except ResponseError:
pass during the first "self.read_response()". This is because we have already patched the send/receive stuff. let me find out a way to fix this test. |
I've pushed three commits here https://github.com/mainframeindustries/redis-py/tree/client-setinfo |
@kristjanvalur thanks a tonne. I don't think I could have debugged this at all... The byproduct was bizarre - especially since frankly, it seemed completel illogical to me. This is my way of saying ❤️ @dvora-h can you take a look at merging this into our branch and seeing how it lies. |
…into client-setinfo
Right, so, the issue was (to summarize) that the new version handshake wasn't getting through because the test had mocked the streams. This caused the hard timeout to occur, which stopped the Task (without cleanup) which left the async connection object in a mocked/patched state. |
There is a problem with mocking in 3.7, let me fix that. |
I've pushed an additional commit fixing 3.7, feel free to merge/cherry pick it. |
Awesome. My gut was down the side of going to repatch the mock for the function.. which I get. Handshaking, across clients is my current balliwick :D |
self.send_command("CLIENT", "SETINFO", "LIB-NAME", self.lib_name) | ||
self.read_response() | ||
if self.lib_version: | ||
self.send_command("CLIENT", "SETINFO", "LIB-VER", self.lib_version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pipeline SETINFO and SELECT same as in the async suggestion above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically not sent because of the interface - but a suggestion we'd debated previously. At this level, the pipeline shouldn't be used (yet). IMHO once reorganizing connections, all items for connect should be pipelined, agreed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you probably debated it out of band, not in this PR :) What "interface" are you speaking of?
A pipeline isn't an object "to be used", it is just a way of sending a bunch of commands and not waiting for each individual response before sending the next command. It is always supported by the server.
The spec specifically recommends pipelining startup commands to reduce latency. We now have two extra roundtrips to the server at startup in addition to the optional one to select a db.
Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com>
Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com>
Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com>
…ys been flaky. IMHO we should revisit whether this test even makes sense anymore.
Pull Request check-list
Please make sure to review and check all of these items:
$ tox
pass with this change (including linting)?NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
closes #2856
closes #2682