-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Is this a new bug?
In other words: Is this an error, flaw, failure or fault? Please search Github issues and check our Community Forum to see if someone has already reported the bug you encountered.
If this is a request for help or troubleshooting code in your own Pinecone project, please join the Pinecone Community Forum.
- I believe this is a new bug
- I have searched the existing Github issues and Community Forum, and I could not find an existing post for this bug
Describe the bug
When running Pinecone's local container under CPU constraints (common in CI environments), the container becomes slow to respond, causing HTTP timeouts and socket closures. The SDK wraps these as PineconeConnectionError but does not retry them, despite these being transient failures that would succeed on retry. The SDK only retries 5xx HTTP status errors, not connection-level failures.
Error information
PineconeConnectionError: Request failed to reach Pinecone. This can occur for reasons such as network problems that prevent the request from being completed, or a Pinecone API outage. Check your network connection, and visit https://status.pinecone.io/ to see whether any outages are ongoing.
at handleApiError (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/errors/handling.ts:37:12)
at Object.onError (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/utils/middleware.ts:91:39)
at VectorOperationsApi.BaseAPI.fetchApi (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/pinecone-generated-ts-fetch/db_data/runtime.ts:210:49)
at VectorOperationsApi.request (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/pinecone-generated-ts-fetch/db_data/runtime.ts:136:26)
... 9 lines matching cause stack trace ...
at Object.<anonymous> (/Users/oscarjuliusadserballe/Fullview/git/nexus1/apps/ai-agent/test/pinecone-without-wrapper.spec.ts:83:7) {
cause: TypeError: fetch failed
at node:internal/deps/undici/undici:13502:13
at VectorOperationsApi.BaseAPI.fetchApi (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/pinecone-generated-ts-fetch/db_data/runtime.ts:206:24)
at VectorOperationsApi.request (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/pinecone-generated-ts-fetch/db_data/runtime.ts:136:26)
at VectorOperationsApi.upsertVectorsRaw (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/pinecone-generated-ts-fetch/db_data/apis/VectorOperationsApi.ts:463:26)
at VectorOperationsApi.upsertVectors (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/pinecone-generated-ts-fetch/db_data/apis/VectorOperationsApi.ts:479:26)
at RetryOnServerFailure.execute (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/utils/retries.ts:36:26)
at UpsertCommand.run (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/data/vectors/upsert.ts:57:5)
at Index.upsert (/Users/oscarjuliusadserballe/Fullview/git/nexus1/node_modules/@pinecone-database/pinecone/src/data/index.ts:516:12)
at async Promise.all (index 3)
at processBatch (/Users/oscarjuliusadserballe/Fullview/git/nexus1/apps/ai-agent/eval/database/populate-pinecone.ts:44:3)
at async Promise.all (index 0)
at populatePinecone (/Users/oscarjuliusadserballe/Fullview/git/nexus1/apps/ai-agent/eval/database/populate-pinecone.ts:97:3)
at Object.<anonymous> (/Users/oscarjuliusadserballe/Fullview/git/nexus1/apps/ai-agent/test/pinecone-without-wrapper.spec.ts:83:7) {
[cause]: SocketError: other side closed
at Socket.<anonymous> (node:internal/deps/undici/undici:6294:28)
at Socket.emit (node:events:530:35)
at endReadableNT (node:internal/streams/readable:1698:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'UND_ERR_SOCKET',
socket: [Object]
}
}
}
Steps to reproduce the issue locally
(Not an exact reproduction script, but reproduction approach if one can call it that)
- Start Pinecone local container with CPU constraint (here we use the test-containers package for convenience, but any method of instantiating a Pinecone client on a machine that will be cpu-bound should work)
import { GenericContainer } from 'testcontainers'; const container = await new GenericContainer('pinecone/pinecone-index') .withEnvironment({ PORT: '5080' }) .withExposedPorts(5080) .withResourcesQuota({ cpu: 0.25 }) // Limit to 0.25 cores .start();
2. Connect Pinecone client to local container
3. Execute multiple parallel upsert operations purposefully pushing it to max CPU-usage:
```typescript
const upsertPromises = [];
for (const batch of batches) {
upsertPromises.push(
index.namespace('test-namespace').upsert(batch)
);
}
await Promise.all(upsertPromises);
-> Some operations fail with:
PineconeConnectionError: Request failed to reach Pinecone. This can occur
for reasons such as network problems that prevent the request from being
completed, or a Pinecone API outage.
Environment
- OS and version: macOS 15.6 (also reproduced in Linux CI environments)
- Node version: v20.18
- Typescript SDK version: @pinecone-database/pinecone@6.1.2
Additional context
Proposed fix: add the PineconeConnectionError as something that should be retried in the retries.js file
Adding the PineconeConnectionError as something that should be retried works.
shouldStopRetrying(error) {
if (error.status) {
return error.status < 500;
}
if (error.name) {
return (error.name !== 'PineconeUnavailableError' &&
error.name !== 'PineconeInternalServerError' &&
error.name !== 'PineconeConnectionError');
}
return true;
}