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

Memory Leak #2214

Open
samirachamplin opened this issue Jul 25, 2022 · 0 comments
Open

Memory Leak #2214

samirachamplin opened this issue Jul 25, 2022 · 0 comments
Labels
p/medium reviewed-medium Medium bug was reviewed & kept as medium t/bug Something isn't working triaged

Comments

@samirachamplin
Copy link

samirachamplin commented Jul 25, 2022

Describe the bug

There appears to be a memory leak with spectral. The resident memory on the machine continues to rise with each validation, and eventually runs out of space and crashes.

To Reproduce

Repeatedly lint a document with spectral.run() in a loop.

Here is the example code snippet that was used:

export async function validate(spec: string): Promise<ISpectralDiagnostic[]> {
  const spectral = new Spectral();
  const ruleset = new Ruleset({extends: [oas]})
  spectral.setRuleset(ruleset);
  while (true) {
    const result = await spectral.run(spec);
    console.log(result.length);
  }
  return spectral.run(spec);
}

Expected behavior
We would expect resident memory to be cleared so the app doesn't crash.

Screenshots

See RES where the residential memory continues to rise. These were captured with htop.

Screen Shot 2022-07-22 at 1 46 41 PM

Screen Shot 2022-07-22 at 2 39 10 PM

Screen Shot 2022-07-22 at 2 39 21 PM

Environment (remove any that are not applicable):

  • "@stoplight/spectral-core": "^1.12.2",
  • "@stoplight/spectral-formats": "^1.2.0",
  • "@stoplight/spectral-functions": "^1.6.1",
  • "@stoplight/spectral-rulesets": "^1.9.0",
  • OS: macOS Big Sur
@philsturgeon philsturgeon added the t/bug Something isn't working label Jul 26, 2022
@P0lip P0lip added the p/medium label Jul 28, 2022
@matty-v matty-v added the reviewed-medium Medium bug was reviewed & kept as medium label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/medium reviewed-medium Medium bug was reviewed & kept as medium t/bug Something isn't working triaged
Projects
None yet
Development

No branches or pull requests

5 participants