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

RangeError: Maximum call stack size exceeded #506

Closed
BanderasPRO opened this issue Oct 3, 2023 · 7 comments
Closed

RangeError: Maximum call stack size exceeded #506

BanderasPRO opened this issue Oct 3, 2023 · 7 comments

Comments

@BanderasPRO
Copy link
Contributor

The bug
Same as #469 and #437

Steps

  1. Create a huge database from HTML
  2. Then search

Expected behavior
No error after search

Code

const texts = await search(ORAMA_DB, {
    term: searchTerm,
    properties: ['content'],
    where: {
      type: { nin: ['title', 'a'] },
    },
    groupBy: {
      properties: ['properties.slug'],
    },
    limit,
  });

Logs

RangeError: Maximum call stack size exceeded
    at filter (file:///dev/node_modules/@orama/orama/dist/trees/flat.js:78:32)
    at Object.searchByWhereClause (file:///dev/node_modules/@orama/orama/dist/components/index.js:312:43)
    at search (file:///dev/node_modules/@orama/orama/dist/methods/search.js:96:45)

After making a local fix, I encountered another issue:

RangeError: Maximum call stack size exceeded
    at Object.searchByWhereClause (file:///dev/node_modules/@orama/orama/dist/components/index.js:312:35)   
    at search (file:///dev/node_modules/@orama/orama/dist/methods/search.js:96:45)

Then I simply searched for .push(... in @orama/orama/dist and found a couple of places where this approach is used:

  • flat.js
  • sorter.js
  • index.js

To be honest, I didn't clone the project; I just looked into the node_modules

It would be great if the fix could be released as soon as possible.

@H4ad
Copy link
Contributor

H4ad commented Oct 4, 2023

Hey, thanks for opening the issue. Are you willing to open a PR to fix this issue? We can ping Michele to give priority once the PR is landed.

You can use this function and change all the references for .push that you found:
https://github.com/oramasearch/orama/blob/13ef4c445231bda98b243dd1f87b8be7c8437c35/packages/orama/src/utils.ts#L20-L37

@micheleriva
Copy link
Member

I would really appreciate a PR for fixing this. I would definitely give this high priority

@BanderasPRO
Copy link
Contributor Author

I've prepared a branch with the fix. Should I get a permissions for the repository?

git push --set-upstream origin fix/maximum-call-stack-size-exceeded
info: please complete authentication in your browser...
remote: Permission to oramasearch/orama.git denied to BanderasPRO.                                        
fatal: unable to access 'https://github.com/oramasearch/orama.git/': The requested URL returned error: 403

@H4ad
Copy link
Contributor

H4ad commented Oct 4, 2023

You should create a pull request, first fork this project, and then push your changes inside a new branch of your fork.

Then, you will see a button on the main page of your fork to create and compare a pull request against the main repo.

See more: https://docs.github.com/en/get-started/quickstart/contributing-to-projects

@BanderasPRO
Copy link
Contributor Author

PR is ready

@BanderasPRO
Copy link
Contributor Author

BanderasPRO commented Oct 5, 2023

Hi,
I'm really looking forward to this correction. I would be very grateful if this fix could be included in the release as soon as possible.

@micheleriva @H4ad

micheleriva pushed a commit that referenced this issue Oct 5, 2023
…rce)` (#506) (#507)

Co-authored-by: Anton Prokopenko <a.prokopenko@crpt.ru>
@micheleriva
Copy link
Member

Fixed in v1.2.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants