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 #2273

Closed
gurusamy opened this issue Oct 25, 2022 · 8 comments · Fixed by #2461
Closed

RangeError: Maximum call stack size exceeded #2273

gurusamy opened this issue Oct 25, 2022 · 8 comments · Fixed by #2461
Assignees

Comments

@gurusamy
Copy link

Hi We are getting this error on production. It is happening on intermittently. Please let me know what could be the issue
RangeError: Maximum call stack size exceeded\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:199:38)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)

@dotansimha
Copy link
Collaborator

dotansimha commented Oct 26, 2022

Hi @gurusamy , can you please share more information and a reproduction?

@gurusamy
Copy link
Author

gurusamy commented Oct 26, 2022

Hi @dotansimha we are not able to reproduce in dev environment. It is happening on production when traffic is high. We could not reproducible on dev load testing also. We are injecting ExecutionContext in singleton class. Any guess what could be the issue?

Below is the sample code

import { Injectable, ExecutionContext } from 'graphql-modules'
@Injectable()
export class SampleProvider extends BaseProvider {
    constructor() {}
   
    @ExecutionContext()
    private context: ExecutionContext
   
    someMethod(data) {
      const value = this.callAPI(data)
    }
}


export class BaseProvider  {
    constructor() {}
   
    private context: ExecutionContext
   
    callAPI() {
      console.log(this.context.reqContext);
      //Call API
    }
}




const resolvers = {
    Query: {
        myQuery(root, args, context, info) {
          context.injector.get(SampleProvider).someMethod(args)
      }
    }
}

@gurusamy
Copy link
Author

@dotansimha We got another error for the same scenario
Maximum call stack size exceeded\n at Map.delete (<anonymous>)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:201:37)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13)\n at destroyContextAndItsChildren (/data/instance/node_modules/graphql-modules/index.js:206:13

@Simon12121
Copy link

Hi @gurusamy and @dotansimha, I have also received this error. However, for me it only occurs when I make database queries with many return objects. Have you already found a solution for this problem?

@ardatan
Copy link
Collaborator

ardatan commented Mar 2, 2023

We need a failing test or a reproduction on CodeSandbox or StackBlitz

@Simon12121
Copy link

Hi @ardatan, I have created a repo on github for reproduction: https://github.com/Simon12121/graphql-modules-bug-replication. Because the error happens only when I make a query to MongoDb with many return objects, you would have to create an Atlas Free cluster. Maybe it happens also with other databases. I have stored my connection-string under environment/.env in the variable MONGO_DB_URI (not present in repo). First you would need to run the Mutation 'initFeatureTest' and the errors happens then when querying 'getAllNames'. I hope you can reproduce the error.

@enisdenjo enisdenjo self-assigned this Nov 2, 2023
@enisdenjo
Copy link
Collaborator

Hey @Simon12121 and @gurusamy, thanks for your patience! Can you try out graphql-modules@2.2.1-alpha-20231102120726-44db491f please? #2461 has potential to fix your issue too. Thanks!

@enisdenjo
Copy link
Collaborator

Fixed in graphql-modules@2.2.1 with #2461. Please try it out!

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

Successfully merging a pull request may close this issue.

5 participants