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

[BUG]: Big CV lists: RangeError: Maximum call stack size exceeded #56

Open
M-casado opened this issue Dec 6, 2022 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@M-casado
Copy link
Contributor

M-casado commented Dec 6, 2022

Bug summary

When loading a huge Controlled Vocabulary (CV) list, the amount of items in the enum keyword exceeds the maximum of the call stack.

Technical details

  • Used GitHub branch: main
  • Operating System: WSL2
  • Node version: v16.13.0
  • npm version: 8.6.0

To reproduce

  1. Clone and install the project
git clone https://github.com/elixir-europe/biovalidator.git
cd biovalidator
npm install
  1. Deploy Biovalidator local server:
node src/biovalidator
  1. Request validation, and in the used schemas, one being way too big. In my case, EGA.cv.instrument_platforms_array.json, with 12.000+ items in enum.
time curl --data @$file -H "Content-Type: application/json" -X POST http://localhost:3020/validate
  1. Observe how long it takes for the initial fetch, and then how it stops the validation, prompting the following message:
{"error":"Failed to compile schema: RangeError: Maximum call stack size exceeded"}
real    0m15.998s
user    0m0.005s
sys     0m0.001s

Observed behaviour

Validation crashes and the document is not validated, since the schema is not compiled correctly.

Expected behaviour

The JSON document $file would be validated accordingly.

Additional context

At the terminal where the server is deployed the following error logs appear:

2022-12-06T13:37:31.464Z [info] Compiling new schema, $schemaId: undefined
2022-12-06T13:37:46.912Z [error] Failed to compile schema: RangeError: Maximum call stack size exceeded
2022-12-06T13:37:46.913Z [error] An error occurred while running the validation: {"error":"Failed to compile schema: RangeError: Maximum call stack size exceeded"}
2022-12-06T13:37:46.914Z [error] New validation request: Server failed to process data: {"error":"Failed to compile schema: RangeError: Maximum call stack size exceeded"}
@M-casado M-casado added the bug Something isn't working label Dec 6, 2022
M-casado added a commit to EbiEga/ega-metadata-schema that referenced this issue Jan 11, 2023
We decided to loose the constraint so that we wouldn't be required to update a never ending CV list, and also to work around elixir-europe/biovalidator#56
@M-casado
Copy link
Contributor Author

We ended up adapting our schemas around this issue, removing the long CV lists. For now it's no longer a blocker on our end.

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