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

Heap out of memory with archiver.append() #722

Open
Dirshant opened this issue Feb 1, 2024 · 1 comment
Open

Heap out of memory with archiver.append() #722

Dirshant opened this issue Feb 1, 2024 · 1 comment

Comments

@Dirshant
Copy link

Dirshant commented Feb 1, 2024

Got a Heap out of memory error,
I am appending 1,000,000 file streams to the archive.append(file_stream, { name: file_name }) one by one in a loop
seems like the archiver keeps the reference of all streams in heap memory finally throwing the Heap out of memory error.

// After archiver initialization and pipe to the output stream
...
...
for (const file of files) {
const result = await S3Service.createLazyDownloadStream(file);
if (result.fileResponse) {
try {
archive.append(result.stream, {name: getKeyPath(result)});
} catch (error) {
Logger.logInfo('Error appending to archive:'+ error);
}
}
}
await archive.finalize();
...
...

@yrx00go
Copy link

yrx00go commented Apr 16, 2024

Have you found the reason?

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

No branches or pull requests

2 participants