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

Fix grpc upload retry timeout #841

Merged
merged 12 commits into from
Nov 15, 2024
Merged

Fix grpc upload retry timeout #841

merged 12 commits into from
Nov 15, 2024

Conversation

hh-space-invader
Copy link
Contributor

@hh-space-invader hh-space-invader commented Nov 6, 2024

Rest has a default timeout (mostly managed by the network stack of the OS if the requests library default to none), but grpc doesn't have a default one. I've added a default value in the channel options.

There's also no default waiting mechanism for waiting before retrying.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you installed pre-commit with pip3 install pre-commit and set up hooks with pre-commit install?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link

netlify bot commented Nov 6, 2024

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit ee57a35
🔍 Latest deploy log https://app.netlify.com/sites/poetic-froyo-8baba7/deploys/673716df4915500008afd1c5
😎 Deploy Preview https://deploy-preview-841--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@hh-space-invader hh-space-invader force-pushed the fix-grpc-upload-retry-timeout branch from 2dfe1a4 to bc85c04 Compare November 13, 2024 21:23
@@ -200,9 +201,23 @@ async def intercept_call(


def parse_channel_options(options: Optional[Dict[str, Any]] = None) -> List[Tuple[str, Any]]:
timeout = f'{str(options.copy().pop("timeout", "10"))}s' if options else "10s"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to extract timeout from options anywhere else?

@@ -2912,6 +2916,7 @@ def _upload_collection(
"metadata": self._grpc_headers,
"wait": wait,
"shard_key_selector": shard_key_selector,
"options": self._grpc_options,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's enough to pass just timeout rather than the whole options

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wrong, it's actually a bug, we've been needing to pass it all the time

Comment on lines 208 to 220
(
"grpc.service_config",
json.dumps(
{
"methodConfig": [
{
"name": [{}],
"timeout": timeout,
},
]
}
),
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels to be too much for this, we already have timeouts in all the methods

  1. it is a little bit ugly because we need to create a json string
  2. if anyone is providing or will provide grpc.service_config via grpc_options it will break things
  3. it does not work as you assume when you look at it, I've done several experiments and it has never waited for timeout, but for timeout - 1s or timeout - 2s. Thus, if we set timeout=1 it just raises an Exception immediately

I would rather add GRPC_DEFAULT_TIMEOUT or something like that to QdrantRemote

@joein joein self-requested a review November 15, 2024 08:34
joein
joein previously approved these changes Nov 15, 2024
@joein joein dismissed their stale review November 15, 2024 08:39

some methods are lacking timeout

@joein joein self-requested a review November 15, 2024 10:04
@joein joein merged commit d6d25ac into dev Nov 15, 2024
15 checks passed
@hh-space-invader hh-space-invader deleted the fix-grpc-upload-retry-timeout branch November 20, 2024 10:50
joein added a commit that referenced this pull request Jan 16, 2025
* improve: Added a default timeout in grpc if the connection is dead

* improve: Added 5 seconds wait before retry

* fix: Fix grpc timeout

* nit

* fix: Fix bug in timeouts
new: Add timeouts to delete and upsert

* new: Propagate timeout to grpc default options
new: Added missing timeouts

* nit

* refactor: Changed how we define the default grpc timeout

* remove redundant import

* fix: add missing timeouts

* fix: Added missing timeout in rest

* fix: Added async

---------

Co-authored-by: George <george.panchuk@qdrant.tech>
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.

2 participants