Skip to content

Conversation

yorickvP
Copy link
Contributor

@yorickvP yorickvP commented May 7, 2025

Problem

When using grpc with async_req=True, the construction of a PineconeGrpcFuture would call _sync_state, which would do a blocking call to grpc_future.exception(...). This means that the async reqs were all blocking in practice.

Describe the purpose of this change. What problem is being solved and why?

Solution

We can fix it by checking if the future is still running and not doing any blocking calls when it is.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

How I tested it:

  • Before: Run a long query in a loop and hit ctrl-c. Observe the traceback containing PineconeGrpcFuture()
  • After: Run a long query in a loop and hit ctrl-c. Observe the traceback containing your .result() call instead.

When using grpc with async_req, the construction of a
PineconeGrpcFuture would call _sync_state, which would do a blocking
call to grpc_future.exception(...). This means that the async_reqs
were all blocking in practice.

We can fix it by checking if the future is still running and not doing
any blocking calls when it is.
@jhamon
Copy link
Collaborator

jhamon commented May 16, 2025

This makes a lot of sense; I didn't realize exception() was blocking . Thanks for the patch.

@jhamon
Copy link
Collaborator

jhamon commented May 16, 2025

Seems like some of the unit tests are broken by this change. I'll need to do some follow-up before we can merge this in.

@yorickvP
Copy link
Contributor Author

I've fixed the unit test.

@jhamon jhamon merged commit 4223351 into pinecone-io:main May 19, 2025
17 of 36 checks passed
@jhamon
Copy link
Collaborator

jhamon commented May 19, 2025

This looks good; the integration tests are expected to fail due to your PR from fork not being able to read secrets from the repo. Thanks!

@jhamon jhamon mentioned this pull request May 19, 2025
1 task
jhamon added a commit that referenced this pull request May 20, 2025
## Problem

A recent change submitted in PR #478 revealed some of the integration
tests were not working as they should be working; some errors related to
incorrect test setup were being masked.

## Solution

Fix broken tests.

## Type of Change

- [x] Bug fix (non-breaking change which fixes an issue)
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