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

Significantly increased memory usage in 3.13.0 #1246

Closed
4 tasks
markrian opened this issue Nov 3, 2022 · 18 comments · Fixed by #1251 or #1729
Closed
4 tasks

Significantly increased memory usage in 3.13.0 #1246

markrian opened this issue Nov 3, 2022 · 18 comments · Fixed by #1251 or #1729
Labels
question Further information is requested

Comments

@markrian
Copy link

markrian commented Nov 3, 2022

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox

    Please make sure the graphql-eslint version under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

3.13.0 has increased memory consumption over 3.12.0, to the point that in CI the process is OOM-killed when run against the GitLab repository.

Using 3.12.0, the job passes reliably, while on 3.13.0 it fails reliably.

To Reproduce
Steps to reproduce the behavior:

(Apologies that this isn't a minimal reproduction. If/when I have time, I'll make one and post it here.)

For now:

  1. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/102654.
  2. The commit fb10562ab186e39800f5006601bce362e0d0474b bumps to 3.13.0, and fails to run in CI.
  3. The commit 46548bfb0e624c4eb5fc3f8120373f8ae11dab7d moves back down to 3.12.0, and runs successfully (as does latest master)

Expected behavior

Memory usage shouldn't be significantly higher than with 3.12.0.

Environment:

  • OS: Linux (Docker image registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-2.7.patched-golang-1.18-node-16.14-postgresql-12:rubygems-3.2-git-2.36-lfs-2.9-chrome-103-yarn-1.22-graphicsmagick-1.3.36), though probably any Linux would do.
  • @graphql-eslint/eslint-plugin: 3.13.0
  • Node.js: 16.14.0

Additional context

I suspect that #1222 might be implicated, since it touches some caching-related stuff and was the most significant change between 3.12.0 and 3.13.0. But that's just a hunch.

@dimaMachina
Copy link
Owner

@markrian thanks for the detailed report, and sorry for this (:

this should be fixed in 3.13.1 version

@dimaMachina dimaMachina added stage/6-released The issue has been solved on a released version of the library kind/bug Bug :-( labels Nov 5, 2022
@markrian
Copy link
Author

markrian commented Nov 7, 2022

@B2o5T Thanks for the fast reply and fix!

Unfortunately, I'm still seeing memory issues with 3.13.1. See this job failure, which ran against 3.13.1.

So, I'm going to reopen this. Let me know if you'd like more information or a reduced test case for this!

Oh, I can't reopen this 😅

@dimaMachina dimaMachina reopened this Nov 7, 2022
@dimaMachina dimaMachina removed the stage/6-released The issue has been solved on a released version of the library label Nov 7, 2022
@dimaMachina
Copy link
Owner

dimaMachina commented Nov 7, 2022

do you have a failure locally as well?

Update:

I suspect that #1222 might be implicated

You are right, It's due to this PR.

I tried to fix it by this check https://github.com/B2o5T/graphql-eslint/blob/b1b5ec7da638a58f96295c885476c16f1fc39963/packages/plugin/src/cache.ts#L23 but seems it's not enough for you.
Does process.env.NODE defined in CI? while running locally with eslint cli it should be defined, but how about ci environment?

@markrian
Copy link
Author

markrian commented Nov 9, 2022

do you have a failure locally as well?

I ran some tests locally, and I found 3.13.0 uses around 1.5GiB compared to 1.4GiB for 3.12.0 and 3.13.1 for that particular job. That doesn't sound like much, but maybe that's just enough to get killed in our CI (I'm not sure exactly what resource limits are like there).

As far as I can tell, yes, NODE is defined in our CI for that job: https://gitlab.com/gitlab-org/gitlab/-/jobs/3296964272#L72-74.

Given that I see effectively identical memory usage between 3.12.0 and 3.13.1 (but not 3.13.0) locally, I wonder if there's some Ci-related caching issue going on. I'll have a look into this.


I don't think this would help this particular case, but looking at the ModuleCache implementation, would it make sense to evict stale entries? I'm not sure if those stale entries are ever used, otherwise, and could then be GCed.

diff --git a/packages/plugin/src/cache.ts b/packages/plugin/src/cache.ts
index 915c391..748af55 100644
--- a/packages/plugin/src/cache.ts
+++ b/packages/plugin/src/cache.ts
@@ -24,6 +24,9 @@ export class ModuleCache<T, K = any> {
       process.hrtime(lastSeen)[0] < settings.lifetime
     ) {
       return result;
+    } else {
+      // evict stale result
+      this.map.delete(cacheKey);
     }
   }
 }

Edit: Ah, no, I see it's getting overwritten elsewhere anyway.

@dimaMachina
Copy link
Owner

Between 3.12.0 and 3.13.0 I also updated graphql-tools/utils, I tried to downgrade it to the same version as in 3.12.0, could you test following alpha version if it fixes your issue? 3.13.2-alpha-20221109140613-1815aa1

@markrian
Copy link
Author

markrian commented Nov 9, 2022

Sadly it still OOMs. It's frustrating that I can't replicate this locally 😩

I think I might just set NODE_OPTIONS=--max-old-space-size=3584 for now instead, or at least try different values.

@markrian
Copy link
Author

markrian commented Nov 9, 2022

Huh, even with NODE_OPTIONS=--max-old-space-size=3584 it got killed 🤔

I'm going to have to put this aside for now and stay on 3.12.0 until I have more time to look into this.

@dimaMachina
Copy link
Owner

I will close this issue due to no activity, will reopen it if it still exist for somebody

@markrian
Copy link
Author

markrian commented Mar 9, 2023

@vitallium managed to figure out what the problem was! Our configuration had this:

operations:
  - '{,ee/,jh/}app/**/*.graphql'

And by enabling logging, we saw we got a lot of cache misses like this:

graphql-eslint:ModuleCache cache miss for [ '{,ee/,jh/}app/**/*.graphql' ]

For whatever reason, the operations array was getting recreated a lot, so it would never result in a cache hit, resulting in the cache growing indefinitely. Switching to a primitive string fixed it:

operations: '{,ee/,jh/}app/**/*.graphql'

That operations gets recreated suggests to me there is an inefficiency somewhere, but I'll leave it up to you @B2o5T as to whether it's worth reopening this for.

@dimaMachina dimaMachina reopened this Mar 9, 2023
@dimaMachina
Copy link
Owner

@markrian thanks for the detailed report, it’s very helpful. I thought the same reference for the documents key is used here https://github.com/B2o5T/graphql-eslint/blob/b3954231ecee964feccdd334acd3135a92e7ccf8/packages/plugin/src/documents.ts#L30 from graphql-config’s project.document 😬

If anyone wants to deep dive feel free until I will have some time to take a look deeply into why it occurs

@dimaMachina dimaMachina added help wanted Extra attention is needed stage/1-reproduction A reproduction exists labels Mar 11, 2023
@dimaMachina
Copy link
Owner

@markrian how can I generate ./tmp/tests/graphql/gitlab_schema_apollo.graphql locally?

@markrian
Copy link
Author

markrian commented Mar 15, 2023

@B2o5T Two ways. The second is probably quicker/easier for your needs.

  • Run scripts/dump_graphql_schema in the GitLab repository.
  • Download the latest schema from master.

@dimaMachina
Copy link
Owner

@markrian seems the problem is with how you run eslint https://gitlab.com/gitlab-org/gitlab/-/blob/master/package.json#L22
I wonder because no one else reported a similar problem once you reported your issue.

"lint:eslint:all": "node scripts/frontend/eslint.js ."

and your custom script https://gitlab.com/gitlab-org/gitlab/-/blob/master/scripts/frontend/eslint.js

const { spawn } = require('child_process');

const runEslint = () => {
  const [, , ...args] = process.argv;
  const child = spawn(`yarn`, ['internal:eslint', ...args], {
    stdio: 'inherit',
  });

  child.on('exit', (code) => {
    process.exitCode = code;

    if (code === 0) {
      return;
    }
    console.log(`
If you are seeing @graphql-eslint offences, the local GraphQL schema dump might be outdated.
Consider updating it by running \`./scripts/dump_graphql_schema\`.
    `);
  });
};

runEslint();

any real benefit of it?

@vitallium I have read your investigation

There is an issue with "graphql-eslint-plugin" cache implementation. The cache is implemented as a Map which stores an array as a reference. Having the "operations" key as an array invokes that issue so we never hit cache because arrays are compared by a reference in JavaScript. See below:

let arr = ['1'];
let cache = new Map();
cache.set(['1'], 1);
cache.has(['1']); // false

But I don't think is true (There is an issue with "graphql-eslint-plugin" cache implementation) because ESLint doesn't reload the config, and return always the same reference for parserOptions (with recommended way of running eslint and without child_process) https://github.com/B2o5T/graphql-eslint/blob/819c046c2a459d2e601a7c58823b3fc4862ece0e/packages/plugin/src/parser.ts#L15

@dimaMachina dimaMachina added question Further information is requested and removed help wanted Extra attention is needed stage/1-reproduction A reproduction exists kind/bug Bug :-( labels Jul 2, 2023
@pleunv
Copy link

pleunv commented Jul 2, 2023

I'm running into memory issues as well as of 3.13.0 and haven't been able to upgrade this library since, as I can't get ESLint to run without crashing, but I haven't been able to debug and/or dig into it further so have nothing useful to contribute to this issue. Fwiw, no custom scripts here, just running ESLint directly.

@dimaMachina
Copy link
Owner

@pleunv try to update to the latest version and run your lint command with debug DEBUG=graphql-eslint:* eslint ...

@pleunv
Copy link

pleunv commented Jul 2, 2023

Locally I can't seem to get it to crash at this time, however, it does still consistently crash on CI:

2023-07-02T20:07:44.5327553Z 2023-07-02T20:07:44.532Z graphql-eslint:schema Loading schema from [ './packages/project/config/api/schema.json', './packages/project/config/api/apollo-graphql-directives.graphql' ]
2023-07-02T20:07:44.5330166Z @graphql-tools/load: normalizePointers ./packages/project/config/api/schema.json: 0.011ms
2023-07-02T20:07:44.5331107Z @graphql-tools/load: normalizePointers ./packages/project/config/api/apollo-graphql-directives.graphql: 0.003ms
2023-07-02T20:07:44.5331731Z @graphql-tools/load: normalizePointers: 0.067ms
2023-07-02T20:07:44.5332379Z @graphql-tools/load: collectDocumentString ./packages/project/config/api/schema.json: 0.005ms
2023-07-02T20:07:44.5332748Z @graphql-tools/load: collectSourcesSync ./packages/project/config/api/schema.json: 0.027ms
2023-07-02T20:07:44.5333133Z @graphql-tools/load: collectDocumentString ./packages/project/config/api/apollo-graphql-directives.graphql: 0.003ms
2023-07-02T20:07:44.5335002Z @graphql-tools/load: collectSourcesSync ./packages/project/config/api/apollo-graphql-directives.graphql: 0.014ms
2023-07-02T20:07:44.5607808Z @graphql-tools/load: loadFileSync ./packages/project/config/api/schema.json: 27.516ms
2023-07-02T20:07:44.5613317Z @graphql-tools/load: collectFallbackSync ./packages/project/config/api/schema.json: 28.053ms
2023-07-02T20:07:44.5623446Z @graphql-tools/load: loadFileSync ./packages/project/config/api/apollo-graphql-directives.graphql: 0.573ms
2023-07-02T20:07:44.5627586Z @graphql-tools/load: collectFallbackSync ./packages/project/config/api/apollo-graphql-directives.graphql: 1.032ms
2023-07-02T20:07:44.5631519Z @graphql-tools/load: collectSourcesSync queue: 29.99ms
2023-07-02T20:07:44.6424505Z @graphql-tools/load: parseSchema /home/vsts/work/1/s/packages/project/config/api/schema.json: 78.718ms
2023-07-02T20:07:44.8370023Z @graphql-tools/load: parseRawSDL /home/vsts/work/1/s/packages/project/config/api/schema.json: 193.915ms
2023-07-02T20:07:44.8479040Z @graphql-tools/load: useComments /home/vsts/work/1/s/packages/project/config/api/schema.json: 0.008ms
2023-07-02T20:07:44.8483385Z @graphql-tools/load: collectValidSources /home/vsts/work/1/s/packages/project/config/api/schema.json: 0.008ms
2023-07-02T20:07:44.8487014Z @graphql-tools/load: parseSource /home/vsts/work/1/s/packages/project/config/api/schema.json: 285.155ms
2023-07-02T20:07:44.8491283Z @graphql-tools/load: parseSchema /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.004ms
2023-07-02T20:07:44.8495219Z @graphql-tools/load: parseRawSDL /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.008ms
2023-07-02T20:07:44.8524508Z @graphql-tools/load: useComments /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 2.415ms
2023-07-02T20:07:44.8528596Z @graphql-tools/load: collectValidSources /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.008ms
2023-07-02T20:07:44.8532489Z @graphql-tools/load: parseSource /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 4.131ms
2023-07-02T20:07:44.8536136Z @graphql-tools/load: prepareResult: 0.011ms
2023-07-02T20:07:44.8539512Z @graphql-tools/load: loadTypedefsSync: 321.322ms
2023-07-02T20:07:47.3035841Z 2023-07-02T20:07:46.802Z graphql-eslint:schema Schema loaded: true
2023-07-02T20:07:47.3036722Z 2023-07-02T20:07:46.803Z graphql-eslint:schema Schema pointers []
2023-07-02T20:07:47.3037144Z 2023-07-02T20:07:46.804Z graphql-eslint:ModuleCache setting entry for [
2023-07-02T20:07:47.3037509Z   './packages/project/config/api/schema.json',
2023-07-02T20:07:47.3037890Z   './packages/project/config/api/apollo-graphql-directives.graphql'
2023-07-02T20:07:47.3038154Z ]
2023-07-02T20:07:47.3038473Z 2023-07-02T20:07:46.866Z graphql-eslint:graphql-config options.skipGraphQLConfig: undefined
2023-07-02T20:07:47.3038957Z 2023-07-02T20:07:46.866Z graphql-eslint:graphql-config Graphql-config path '/home/vsts/work/1/s/.graphqlrc.yml'
2023-07-02T20:07:47.3039382Z 2023-07-02T20:07:46.867Z graphql-eslint:ModuleCache cache miss for [
2023-07-02T20:07:47.3039739Z   './packages/project/config/api/schema.json',
2023-07-02T20:07:47.3040089Z   './packages/project/config/api/apollo-graphql-directives.graphql'
2023-07-02T20:07:47.3040346Z ]
2023-07-02T20:07:47.3040793Z 2023-07-02T20:07:46.867Z graphql-eslint:schema Loading schema from [ './packages/project/config/api/schema.json', './packages/project/config/api/apollo-graphql-directives.graphql' ]
2023-07-02T20:07:47.3041286Z @graphql-tools/load: normalizePointers ./packages/project/config/api/schema.json: 0.011ms
2023-07-02T20:07:47.3041723Z @graphql-tools/load: normalizePointers ./packages/project/config/api/apollo-graphql-directives.graphql: 0.004ms
2023-07-02T20:07:47.3042096Z @graphql-tools/load: normalizePointers: 0.105ms
2023-07-02T20:07:47.3042489Z @graphql-tools/load: collectDocumentString ./packages/project/config/api/schema.json: 0.005ms
2023-07-02T20:07:47.3042898Z @graphql-tools/load: collectSourcesSync ./packages/project/config/api/schema.json: 0.06ms
2023-07-02T20:07:47.3043332Z @graphql-tools/load: collectDocumentString ./packages/project/config/api/apollo-graphql-directives.graphql: 0.003ms
2023-07-02T20:07:47.3043797Z @graphql-tools/load: collectSourcesSync ./packages/project/config/api/apollo-graphql-directives.graphql: 0.032ms
2023-07-02T20:07:47.3044229Z @graphql-tools/load: loadFileSync ./packages/project/config/api/schema.json: 83.123ms
2023-07-02T20:07:47.3044641Z @graphql-tools/load: collectFallbackSync ./packages/project/config/api/schema.json: 89.387ms
2023-07-02T20:07:47.3049570Z @graphql-tools/load: loadFileSync ./packages/project/config/api/apollo-graphql-directives.graphql: 0.871ms
2023-07-02T20:07:47.3050022Z @graphql-tools/load: collectFallbackSync ./packages/project/config/api/apollo-graphql-directives.graphql: 0.978ms
2023-07-02T20:07:47.3050410Z @graphql-tools/load: collectSourcesSync queue: 90.527ms
2023-07-02T20:07:48.8212593Z @graphql-tools/load: parseSchema /home/vsts/work/1/s/packages/project/config/api/schema.json: 1.863s
2023-07-02T20:07:48.9171234Z @graphql-tools/load: parseRawSDL /home/vsts/work/1/s/packages/project/config/api/schema.json: 87.531ms
2023-07-02T20:07:48.9174358Z @graphql-tools/load: useComments /home/vsts/work/1/s/packages/project/config/api/schema.json: 0.006ms
2023-07-02T20:07:48.9175283Z @graphql-tools/load: collectValidSources /home/vsts/work/1/s/packages/project/config/api/schema.json: 0.007ms
2023-07-02T20:07:48.9175842Z @graphql-tools/load: parseSource /home/vsts/work/1/s/packages/project/config/api/schema.json: 1.959s
2023-07-02T20:07:48.9176637Z @graphql-tools/load: parseSchema /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.004ms
2023-07-02T20:07:48.9177198Z @graphql-tools/load: parseRawSDL /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.005ms
2023-07-02T20:07:48.9180365Z @graphql-tools/load: useComments /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.171ms
2023-07-02T20:07:48.9181003Z @graphql-tools/load: collectValidSources /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.006ms
2023-07-02T20:07:48.9181518Z @graphql-tools/load: parseSource /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.51ms
2023-07-02T20:07:48.9182056Z @graphql-tools/load: prepareResult: 0.01ms
2023-07-02T20:07:48.9182528Z @graphql-tools/load: loadTypedefsSync: 2.051s
2023-07-02T20:07:49.3327813Z 2023-07-02T20:07:49.332Z graphql-eslint:schema Schema loaded: true
2023-07-02T20:07:49.3376475Z 2023-07-02T20:07:49.337Z graphql-eslint:schema Schema pointers []
2023-07-02T20:07:49.3377068Z 2023-07-02T20:07:49.337Z graphql-eslint:ModuleCache setting entry for [
2023-07-02T20:07:49.3377384Z   './packages/project/config/api/schema.json',
2023-07-02T20:07:49.3377665Z   './packages/project/config/api/apollo-graphql-directives.graphql'
2023-07-02T20:07:49.3377855Z ]
2023-07-02T20:07:49.3616597Z 2023-07-02T20:07:49.361Z graphql-eslint:graphql-config options.skipGraphQLConfig: undefined
2023-07-02T20:07:49.3617225Z 2023-07-02T20:07:49.361Z graphql-eslint:graphql-config Graphql-config path '/home/vsts/work/1/s/.graphqlrc.yml'
2023-07-02T20:07:49.3621995Z 2023-07-02T20:07:49.362Z graphql-eslint:ModuleCache cache miss for [
2023-07-02T20:07:49.3622459Z   './packages/project/config/api/schema.json',
2023-07-02T20:07:49.3622759Z   './packages/project/config/api/apollo-graphql-directives.graphql'
2023-07-02T20:07:49.3622943Z ]
2023-07-02T20:07:49.3623371Z 2023-07-02T20:07:49.362Z graphql-eslint:schema Loading schema from [ './packages/project/config/api/schema.json', './packages/project/config/api/apollo-graphql-directives.graphql' ]
2023-07-02T20:07:49.3626602Z @graphql-tools/load: normalizePointers ./packages/project/config/api/schema.json: 0.011ms
2023-07-02T20:07:49.3627406Z @graphql-tools/load: normalizePointers ./packages/project/config/api/apollo-graphql-directives.graphql: 0.003ms
2023-07-02T20:07:49.3628236Z @graphql-tools/load: normalizePointers: 0.075ms
2023-07-02T20:07:49.3630817Z @graphql-tools/load: collectDocumentString ./packages/project/config/api/schema.json: 0.006ms
2023-07-02T20:07:49.3631534Z @graphql-tools/load: collectSourcesSync ./packages/project/config/api/schema.json: 0.036ms
2023-07-02T20:07:49.3632378Z @graphql-tools/load: collectDocumentString ./packages/project/config/api/apollo-graphql-directives.graphql: 0.003ms
2023-07-02T20:07:49.3633478Z @graphql-tools/load: collectSourcesSync ./packages/project/config/api/apollo-graphql-directives.graphql: 0.014ms
2023-07-02T20:07:49.5438094Z @graphql-tools/load: loadFileSync ./packages/project/config/api/schema.json: 180.475ms
2023-07-02T20:07:49.5439462Z @graphql-tools/load: collectFallbackSync ./packages/project/config/api/schema.json: 180.552ms
2023-07-02T20:07:49.5485539Z @graphql-tools/load: loadFileSync ./packages/project/config/api/apollo-graphql-directives.graphql: 4.751ms
2023-07-02T20:07:49.5486590Z @graphql-tools/load: collectFallbackSync ./packages/project/config/api/apollo-graphql-directives.graphql: 4.806ms
2023-07-02T20:07:49.5487563Z @graphql-tools/load: collectSourcesSync queue: 185.423ms
2023-07-02T20:07:51.2703236Z @graphql-tools/load: parseSchema /home/vsts/work/1/s/packages/project/config/api/schema.json: 1.722s
2023-07-02T20:07:51.3405619Z @graphql-tools/load: parseRawSDL /home/vsts/work/1/s/packages/project/config/api/schema.json: 69.749ms
2023-07-02T20:07:51.3413032Z @graphql-tools/load: useComments /home/vsts/work/1/s/packages/project/config/api/schema.json: 0.005ms
2023-07-02T20:07:51.3417040Z @graphql-tools/load: collectValidSources /home/vsts/work/1/s/packages/project/config/api/schema.json: 0.008ms
2023-07-02T20:07:51.3420601Z @graphql-tools/load: parseSource /home/vsts/work/1/s/packages/project/config/api/schema.json: 1.794s
2023-07-02T20:07:51.3424354Z @graphql-tools/load: parseSchema /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.005ms
2023-07-02T20:07:51.3428037Z @graphql-tools/load: parseRawSDL /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.006ms
2023-07-02T20:07:51.3434426Z @graphql-tools/load: useComments /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.175ms
2023-07-02T20:07:51.3438321Z @graphql-tools/load: collectValidSources /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 0.007ms
2023-07-02T20:07:51.3441897Z @graphql-tools/load: parseSource /home/vsts/work/1/s/packages/project/config/api/apollo-graphql-directives.graphql: 1.774ms
2023-07-02T20:07:51.3445502Z @graphql-tools/load: prepareResult: 0.011ms
2023-07-02T20:07:51.3448876Z @graphql-tools/load: loadTypedefsSync: 1.982s
2023-07-02T20:07:51.6687443Z 2023-07-02T20:07:51.668Z graphql-eslint:schema Schema loaded: true
2023-07-02T20:07:51.6780904Z 2023-07-02T20:07:51.677Z graphql-eslint:schema Schema pointers []
2023-07-02T20:07:51.6785864Z 2023-07-02T20:07:51.678Z graphql-eslint:ModuleCache setting entry for [
2023-07-02T20:07:51.6786712Z   './packages/project/config/api/schema.json',
2023-07-02T20:07:51.6787675Z   './packages/project/config/api/apollo-graphql-directives.graphql'
2023-07-02T20:07:51.6788180Z ]
2023-07-02T20:07:51.7164900Z 2023-07-02T20:07:51.716Z graphql-eslint:graphql-config options.skipGraphQLConfig: undefined
2023-07-02T20:07:51.7169697Z 2023-07-02T20:07:51.716Z graphql-eslint:graphql-config Graphql-config path '/home/vsts/work/1/s/.graphqlrc.yml'
2023-07-02T20:07:51.7178691Z 2023-07-02T20:07:51.717Z graphql-eslint:ModuleCache cache miss for [
2023-07-02T20:07:51.7179542Z   './packages/project/config/api/schema.json',
2023-07-02T20:07:51.7180157Z   './packages/project/config/api/apollo-graphql-directives.graphql'
2023-07-02T20:07:51.7180702Z ]
2023-07-02T20:07:51.7220494Z 2023-07-02T20:07:51.721Z graphql-eslint:schema Loading schema from [ './packages/project/config/api/schema.json', './packages/project/config/api/apollo-graphql-directives.graphql' ]
2023-07-02T20:07:51.7225069Z @graphql-tools/load: normalizePointers ./packages/project/config/api/schema.json: 0.011ms
2023-07-02T20:07:51.7228775Z @graphql-tools/load: normalizePointers ./packages/project/config/api/apollo-graphql-directives.graphql: 0.006ms
2023-07-02T20:07:51.7232226Z @graphql-tools/load: normalizePointers: 0.773ms
2023-07-02T20:07:51.7236889Z @graphql-tools/load: collectDocumentString ./packages/project/config/api/schema.json: 0.007ms
2023-07-02T20:07:51.7240892Z @graphql-tools/load: collectSourcesSync ./packages/project/config/api/schema.json: 0.427ms
2023-07-02T20:07:51.7244572Z @graphql-tools/load: collectDocumentString ./packages/project/config/api/apollo-graphql-directives.graphql: 0.006ms
2023-07-02T20:07:51.7248088Z @graphql-tools/load: collectSourcesSync ./packages/project/config/api/apollo-graphql-directives.graphql: 0.367ms
2023-07-02T20:07:54.4745118Z 
2023-07-02T20:07:54.4746653Z <--- Last few GCs --->
2023-07-02T20:07:54.4747219Z 
2023-07-02T20:07:54.4748608Z [1820:0x66f8430]   263439 ms: Scavenge 1993.6 (2061.1) -> 1987.8 (2077.1) MB, 24.79 / 0.00 ms  (average mu = 0.349, current mu = 0.370) allocation failure; 
2023-07-02T20:07:54.4749704Z [1820:0x66f8430]   263537 ms: Scavenge 2003.0 (2077.1) -> 1990.3 (2077.6) MB, 21.98 / 0.00 ms  (average mu = 0.349, current mu = 0.370) allocation failure; 
2023-07-02T20:07:54.4750452Z [1820:0x66f8430]   263591 ms: Scavenge 2006.0 (2078.1) -> 1993.9 (2078.9) MB, 14.62 / 0.00 ms  (average mu = 0.349, current mu = 0.370) allocation failure; 
2023-07-02T20:07:54.4750930Z 
2023-07-02T20:07:54.4751334Z 
2023-07-02T20:07:54.4751775Z <--- JS stacktrace --->
2023-07-02T20:07:54.4751904Z 
2023-07-02T20:07:54.4752219Z FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
2023-07-02T20:07:54.4756868Z  1: 0xc8d700 node::Abort() [node]
2023-07-02T20:07:54.4762272Z  2: 0xb6b8f3  [node]
2023-07-02T20:07:54.4769081Z  3: 0xeac370 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
2023-07-02T20:07:54.4775880Z  4: 0xeac657 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
2023-07-02T20:07:54.4783486Z  5: 0x10bdcc5  [node]
2023-07-02T20:07:54.4791311Z  6: 0x10be254 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
2023-07-02T20:07:54.4799007Z  7: 0x10d5144 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [node]
2023-07-02T20:07:54.4806684Z  8: 0x10d595c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
2023-07-02T20:07:54.4814403Z  9: 0x10abc61 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
2023-07-02T20:07:54.4821977Z 10: 0x10acdf5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
2023-07-02T20:07:54.4829476Z 11: 0x108a366 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
2023-07-02T20:07:54.4839555Z 12: 0x14e5196 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
2023-07-02T20:07:54.4839974Z 13: 0x7f294fe99ef6 
2023-07-02T20:07:54.8119533Z undefined
2023-07-02T20:07:54.8128324Z /home/vsts/work/1/s/packages/project:
2023-07-02T20:07:54.8130531Z  ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  project@4.2.0 lint: `cross-env NODE_ENV=test DEBUG=graphql-eslint:* eslint --cache --cache-location=node_modules/.cache/eslint/ --cache-strategy content --ext=.js,.jsx,.ts,.tsx,.cts,.mts,.gql src scripts`
2023-07-02T20:07:54.8131027Z Exit status 1
2023-07-02T20:07:54.8380181Z ##[error]Bash exited with code '1'.
2023-07-02T20:07:54.8390665Z ##[section]Finishing: Run eslint

I do notice a massive perf regression when running locally.

v3.12.0:

✖ 135 problems (0 errors, 135 warnings)

pnpm run lint  77.41s user 7.12s system 130% cpu 1:04.88 total

v3.19.3:

✖ 135 problems (0 errors, 135 warnings)

pnpm run lint  269.03s user 34.86s system 163% cpu 3:06.25 total

Both instances are run without a cache.

@dimaMachina
Copy link
Owner

dimaMachina commented Jul 3, 2023

@pleunv try remove NODE_ENV=test, graphql-eslint doesn't cache graphql-config if process.env.NODE_ENV === 'test'
https://github.com/B2o5T/graphql-eslint/blob/50e853c91655cf4d6f6439d3a25170a3c252b8d7/packages/plugin/src/graphql-config.ts#L26-L30

if it fixes your issue I'll try to remove all unrelated code from production build

@pleunv
Copy link

pleunv commented Jul 3, 2023

Oh wow... Yeah, that was it! Back to normal speeds now. Not even sure why it was there, probably a remnant from the babel-parser days where I had a faster test-specific transform config. Many many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
3 participants