- 
                Notifications
    
You must be signed in to change notification settings  - Fork 10.3k
 
Open
Labels
status: triage neededIssue or pull request that need to be triaged and assigned to a reviewerIssue or pull request that need to be triaged and assigned to a reviewertype: bugAn issue or pull request relating to a bug in GatsbyAn issue or pull request relating to a bug in Gatsby
Description
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
 - This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
 
Description
Due to not handling of failure here, for any failed i, files from 0 - i-1, remains on the disk, and with each build they keep growing resulting in high disk usage.
gatsby/packages/gatsby/src/redux/persist.ts
Lines 190 to 193 in e8e17e7
| writeFileSync( | |
| reduxChunkedPagesFilePrefix(targetDir) + i, | |
| v8.serialize(values.slice(i * chunkSize, i * chunkSize + chunkSize)) | |
| ) | 
Each build creates a unique tmpdir - https://github.com/gatsbyjs/gatsby/blob/e8e17e774c4a90333a2277b44733bb4b48f2e102/packages/gatsby/src/redux/persist.ts#L237C18-L237C29
In scenarios, where buffer size exceeds serialization limits, it breaks the for loop.
Reproduction Link
NA
Steps to Reproduce
Cannot share as it's private repo.
Here's a screen recording
2.mp4
Expected Result
Files should be cleaned up properly
Actual Result
Files are not being cleaned up
Environment
NAConfig Flags
NA
Metadata
Metadata
Assignees
Labels
status: triage neededIssue or pull request that need to be triaged and assigned to a reviewerIssue or pull request that need to be triaged and assigned to a reviewertype: bugAn issue or pull request relating to a bug in GatsbyAn issue or pull request relating to a bug in Gatsby