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

Maximum call stack size exceeded error coming from reporter/global-reporter.js #3647

Open
kretschmannj opened this issue Mar 15, 2023 · 6 comments
Labels
p2 reporters Issues related to Nightwatch Reporters, and custom reporters integrations

Comments

@kretschmannj
Copy link

Description of the bug/issue

Error

931 | uncaughtException: Maximum call stack size exceeded
932 | RangeError: Maximum call stack size exceeded
933 | at String.replace ()
934 | at process (/codebuild/output/src055282788/src/github.com/magellan-health/portal-ui-tests/node_modules/ansi-to-html/lib/ansi_to_html.js:507:17)
935 | at tokenize (/codebuild/output/src055282788/src/github.com/magellan-health/portal-ui-tests/node_modules/ansi-to-html/lib/ansi_to_html.js:517:7)
936 | at Filter.toHtml (/codebuild/output/src055282788/src/github.com/magellan-health/portal-ui-tests/node_modules/ansi-to-html/lib/ansi_to_html.js:605:7)
937 | at /codebuild/output/src055282788/src/github.com/magellan-health/portal-ui-tests/node_modules/nightwatch/lib/reporter/global-reporter.js:69:39
938 | at Array.map ()
939 | at GlobalReporter.addTestSuiteResults (/codebuild/output/src055282788/src/github.com/magellan-health/portal-ui-tests/node_modules/nightwatch/lib/reporter/global-reporter.js:67:43)
940 | at Concurrency. (/codebuild/output/src055282788/src/github.com/magellan-health/portal-ui-tests/node_modules/nightwatch/lib/reporter/global-reporter.js:85:14)
941 | at Concurrency.emit (events.js:400:28)
942 | at ChildProcess. (/codebuild/output/src055282788/src/github.com/magellan-health/portal-ui-tests/node_modules/nightwatch/lib/runner/concurrency/index.js:181:12)

Steps to reproduce

No response

Sample test

No response

Command to run

No response

Verbose Output

No response

Nightwatch Configuration

No response

Nightwatch.js Version

2.6.18

Node Version

No response

Browser

No response

Operating System

No response

Additional Information

No response

@harshit-bs
Copy link
Member

Hey @kretschmannj, Could you provide a sample test/steps to replicate the issue?

@harshit-bs harshit-bs added needs more info reporters Issues related to Nightwatch Reporters, and custom reporters integrations labels Mar 29, 2023
@kretschmannj
Copy link
Author

I was unable to reproduce this problem and I haven't seen it since I opened this issue. Therefore, I'm going to close this.

@kretschmannj
Copy link
Author

This problem is back and it's a blocker. I'm running a large test and this error seems to be triggered when there are errors. I'm on Nightwatch v2.6.18 and I'm tempted to roll back to some previous version to see if this helps. However, this is a major undertaking as I need to run the entire test suite to reproduce the problem and this can take upwards of 30 minutes per run. Have there been any recent updates to the Nightwatch reporter?

@kretschmannj
Copy link
Author

kretschmannj commented Jun 1, 2023

After much research, I have found the issue. I use a package called nightwatch-xhr to capture XHR responses from the browser. These responses go into the testResults object which is then processed by the global-reporter.js at the end of the test. The global-reporter.js utilizes ansi-to-html to process the results and it turns out that one of these XHR responses is HUGE (2.6MB) and this is causing ansi-to-html to blow up with the RangeError: Maximum call stack size exceeded error.

Root cause seems to be that ansi-to-html has a limit on how much data it can process. Perhaps I'll open an issue in their GitHub project. In the meantime, I'll remove the commands in my test that are capturing these XHR responses.

@kretschmannj
Copy link
Author

kretschmannj commented Jun 1, 2023

Turns out there's already an issue logged for this in ansi-to-html ... logged over 2 years ago ...

rburns/ansi-to-html#87

There is, however, a bug that was introduced in some of the recent changes to the NIghtwatch reporter. Previously, running in v2.4.1 I would get the call stack error but Nightwatch would run to completion and the results file would be generated. However, when I upgrade to version 2.6.x then Nightwatch aborts when it hits the call stack error and no results file is generated. So it seems Nightwatch is no longer handling the situation in which ansi-to-html barfs.

@swrdfish
Copy link
Member

swrdfish commented Jun 2, 2023

@kretschmannj thank you for the analysis, yes this looks like a bug in ansi-to-html. It used to work in v2.4.1 because we were not using ansi-to-html for a portion of the log. Not sure what we can do here, maybe we can try to fix the bug in ansi-to-html or we might try to find a different library which does the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 reporters Issues related to Nightwatch Reporters, and custom reporters integrations
Projects
None yet
Development

No branches or pull requests

3 participants