Unpredictable Connection Aborted Errors

urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/src/Embedding/EmbeddingPredictor.py", line 90, in predict

    self.embedding_handler.put_batch("", vectors)

  File "/src/Embedding/ApiHandler/EmbeddingHandler.py", line 186, in put_batch
    response = self.index.upsert(

  File "/venv/lib/python3.9/site-packages/pinecone/core/utils/error_handling.py", line 25, in inner_func

    raise PineconeProtocolError(f'Failed to connect; did you specify the correct index name?') from e

pinecone.core.exceptions.PineconeProtocolError: Failed to connect; did you specify the correct index name?

Using the same index object, I get these errors every once in a while. I know its the correct index because I do have some successful calls.

Hi @PineconeLover123,

Check that you’re using the latest version of the Python client, 2.2.1. It has some improved retry logic to handle these scenarios. If you’re already using that version, I’d recommend adding some try logic to your query wrapper to re-initiate the index connection periodically. It’s likely the connection is dying due to timeouts, but initiating a new connection via pinecone.Index("your_index") should help.

Also, I recommend you consider using the client’s gRPC version, as it is far faster and more robust than the REST version.

How is this done?

I’m getting the same

pinecone.core.exceptions.PineconeProtocolError: Failed to connect; did you specify the correct index name?

I ran
pip3 install "pinecone-client[grpc]"

What else needs to be done to use it instead of REST?

You should replace all pinecone indices “pinecone.Index(indexName)” with “pinecone.GRPCIndex(indexName)”

1 Like

Using this I still get the error:

PineconeException: UNKNOWN:failed to connect to all addresses; last error: UNAVAILABLE: ipv4:34.127.5.128:443: recvmsg:Connection reset by peer {created_time:"2023-09-28T20:38:58.196686658+00:00", grpc_status:14}