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(createVectorStoreNode): Prevent connection leaks in PGVectorStore… #12408

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lchavezpozo
Copy link

Summary

This PR fixes an issue related to connection pool management in the PostgreSQL pool of the VectorStorePGVector node. It was identified that connections were not being properly released, leading to connection leaks and eventually blocking access to PostgreSQL.

Related Linear tickets, Github issues, and Community forum posts

https://community.n8n.io/t/postgres-connection-error-sorry-too-many-clients-already/63473/1

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@CLAassistant
Copy link

CLAassistant commented Dec 31, 2024

CLA assistant check
All committers have signed the CLA.

@n8n-assistant n8n-assistant bot added community Authored by a community member in linear Issue or PR has been created in Linear for internal review labels Dec 31, 2024
@Joffcom
Copy link
Member

Joffcom commented Dec 31, 2024

Hey @lchavezpozo,

Thanks for the PR, We have created "GHC-614" as the internal reference to get this reviewed.

One of us will be in touch if there are any changes needed, in most cases this is normally within a couple of weeks but it depends on the current workload of the team.

@@ -395,7 +396,14 @@ export const createVectorStoreNode = (args: VectorStoreNodeConstructorArgs) =>

if (mode === 'retrieve') {
const vectorStore = await args.getVectorStoreClient(this, filter, embeddings, itemIndex);

async function closeFunction() {
Copy link
Member

Choose a reason for hiding this comment

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

Can you revert the changes to this file, and merge back the latest master?
I think the closeFunction removal in the other file is all that's needed now after #12346

Copy link
Author

Choose a reason for hiding this comment

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

If I don’t include this change, PGVectorStore will also increase the connections to Postgres. I couldn’t find a cleaner way to apply this adjustment. I ran tests by removing closeFunction, but the connections still increased.”

@lchavezpozo lchavezpozo requested a review from netroy December 31, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants