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

Process crashes with: Cannot create a string longer than 0x1fffffe8 characters #865

Open
michaelbromley opened this issue Nov 4, 2024 · 5 comments
Assignees
Labels
🐛 bug something isn't working

Comments

@michaelbromley
Copy link

michaelbromley commented Nov 4, 2024

What happened?

I attempted to run npx code-pushup and got the following error:

Cannot create a string longer than 0x1fffffe8 characters

What would you expect to happen?

No error, and the command to complete successfully.

What steps did you take?

Set up per the getting started guide, with the following config:

import type { CoreConfig } from '@code-pushup/models';
import eslintPlugin, { eslintConfigFromAllNxProjects} from '@code-pushup/eslint-plugin';

const config: CoreConfig = {
  plugins: [
    await eslintPlugin(await eslintConfigFromAllNxProjects()),
  ],
};

export default config;

Run

npx code-pushup

Code PushUp package version

No response

What operation system are you on?

Windows 11

Node version

20.18.0

"@code-pushup/cli": "^0.53.1",     "@code-pushup/eslint-plugin": "^0.53.1",

Relevant log output

Code PushUp CLI
[ info ] Run collect...

[ warn ] Plugins failed: 
[ warn ] Error: - Plugin ESLint (eslint) produced the following error:
  - node:buffer:834
    return this.utf8Slice(0, this.length);
                ^

Error: Cannot create a string longer than 0x1fffffe8 characters
    at Buffer.toString (node:buffer:834:17)
    at String (<anonymous>)
    at Socket.<anonymous> (file:///<path to project>/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@code-pushup/eslint-plugin/bin.js:755:17)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:191:23) {
  code: 'ERR_STRING_TOO_LONG'
}
@michaelbromley michaelbromley added the 🐛 bug something isn't working label Nov 4, 2024
@michaelbromley michaelbromley changed the title Bug report Process crashes with: Cannot create a string longer than 0x1fffffe8 characters Nov 4, 2024
@vmasek
Copy link
Collaborator

vmasek commented Nov 5, 2024

Thanks for the report 🚀 We'll try to reproduce the error in our codebase.

@vmasek
Copy link
Collaborator

vmasek commented Nov 5, 2024

I think I located the problem to string appending at executeProcess fn and this explanation of the error as system limit of the buffer size in NodeJS (0x1fffffe8 is almost exactly 512MB.)

@michaelbromley Is my assumption you are running it on a significantly large project correct?

@vmasek vmasek self-assigned this Nov 5, 2024
@michaelbromley
Copy link
Author

Yes, a large multi tenant Nx monorepo.

@vmasek
Copy link
Collaborator

vmasek commented Nov 6, 2024

It seems like the standard output that we cumulate with intention to print in at once at the end of the task gets too big. I have a Buffer based solution in progress now, I'll ping you when the new version is released to try it out.

@vmasek
Copy link
Collaborator

vmasek commented Nov 9, 2024

Error itself seems to point to direction of too large JSON being processed from ESLint analysis output. So far we avoided it by splitting projects in big monorepos but since you use eslintConfigFromAllNxProjects in your example, the projects are already auto-split, meaning you probably have one project that outputs data that large.
I've already consulted how we can change the processing from output passing to file/stream reading, so we need to do this bigger change 🏗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants