rburns/ansi-to-html

RangeError: Maximum call stack size exceeded

Opened this issue · 1 comments

script-view.js:180 RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    at process (C:\atom-script\node_modules\.pnpm\ansi-to-html@0.6.14\node_modules\ansi-to-html\lib\ansi_to_html.js:506:17)
    at tokenize (C:\atom-script\node_modules\.pnpm\ansi-to-html@0.6.14\node_modules\ansi-to-html\lib\ansi_to_html.js:516:7)
    at Filter.toHtml (C:\atom-script\node_modules\.pnpm\ansi-to-html@0.6.14\node_modules\ansi-to-html\lib\ansi_to_html.js:606:7)
    at ScriptView.display (file:///C:/Users/aminy/Documents/GitHub/JavaScript/@atom-ide-community/atom-script/lib/script-view.js:177:30)
    at file:///C:/Users/aminy/Documents/GitHub/JavaScript/@atom-ide-community/atom-script/lib/view-runtime-observer.js:16:73
    at Function.simpleDispatch (C:\Users\aminy\AppData\Local\atom\app-1.55.0\resources\app\static\<embedded>:11:1190181)
    at Emitter.emit (C:\Users\aminy\AppData\Local\atom\app-1.55.0\resources\app\static\<embedded>:11:1191622)
    at Runner.stdoutFunc (file:///C:/Users/aminy/Documents/GitHub/JavaScript/@atom-ide-community/atom-script/lib/runner.js:44:18)
    at Socket.<anonymous> (C:\Users\aminy\AppData\Local\atom\app-1.55.0\resources\app\static\<embedded>:14:1120219)
    at Socket.emit (events.js:200:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:271:13)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)
display @ script-view.js:180
(anonymous) @ view-runtime-observer.js:16
simpleDispatch @ <embedded>:11
emit @ <embedded>:11
stdoutFunc @ runner.js:44
(anonymous) @ <embedded>:14
emit @ events.js:200
addChunk @ _stream_readable.js:294
readableAddChunk @ _stream_readable.js:271
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
script-view.js:181 &lt;!DOCTYPE html&gt;

It is the output of the following python code which triggers this error:

import requests

head = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36'}

r = requests.get('https://www.oxfordlearnersdictionaries.com/us/wordlists/oxford3000-5000', headers=head)

print(r.text)

Related to atom-community/atom-script#2358

I came across this same issue recently and it obviously hasn't been resolved yet. I use a tool called Nightwatch for test automation and there are commands in my test that capture XHR responses from the browser. These responses go into a testResults object which is then processed with a function that utilizes ansi-to-html to process the results. One of these XHR responses is relatively large (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.