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

langchain[patch]: Fix memory issue for large number of child chunks on large documents #5989

Conversation

clemenspeters
Copy link
Contributor

Fixes OOM issues. The docker container of our index manager is killed on specific documents after using more than 2GB of memory. For large documents the ParentDocumentRetriever can create lots of parent and child documents.

While this change seems to fix the memory issues, I'm still investigating another issue on the same large document at the moment: Uncaught exception: error: terminating connection due to idle-session timeout.

@PetersClemens

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 5, 2024
Copy link

vercel bot commented Jul 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 5, 2024 9:07pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview Jul 5, 2024 9:07pm

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Jul 5, 2024
@jacoblee93 jacoblee93 changed the title Fix memory issue for large number of child chunks on large documents langchain[patch]: Fix memory issue for large number of child chunks on large documents Jul 9, 2024
}
if (addToDocstore) {
await this.docstore.mset(Object.entries(fullDocs));
await this._storeDocuments(parentDoc, taggedSubDocs, addToDocstore);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Flagging that this does make it a bit more likely that we'll get into half-finished states

Copy link
Collaborator

@jacoblee93 jacoblee93 left a comment

Choose a reason for hiding this comment

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

Thank you!

@dosubot dosubot bot added the lgtm PRs that are ready to be merged as-is label Jul 9, 2024
jacoblee93 added a commit that referenced this pull request Jul 9, 2024
* Fix memory issue for large number of chunks on large documents

* Format

---------

Co-authored-by: Clemens Peters <c.peters@conventic.com>
@jacoblee93
Copy link
Collaborator

Couldn't push to your branch so merged in #6012 after running yarn format

@jacoblee93 jacoblee93 closed this Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature lgtm PRs that are ready to be merged as-is size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants