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

Call Stack Size Exceeded #104

Open
brandonparsons opened this issue Jan 11, 2018 · 4 comments
Open

Call Stack Size Exceeded #104

brandonparsons opened this issue Jan 11, 2018 · 4 comments

Comments

@brandonparsons
Copy link

Hi there,

I'm getting the following error when trying to use this library:

~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:870
Parser.prototype._isSpecialElement = function (element) {
                                              ^

RangeError: Maximum call stack size exceeded
    at module.exports.Parser._isSpecialElement (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:870:47)
    at genericEndTagInBody (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:1899:15)
    at Object.endTagInBody [as END_TAG_TOKEN] (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:2002:17)
    at module.exports.Parser._processToken (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:619:38)
    at module.exports.parser._processToken (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/location_info_mixin.js:89:35)
    at module.exports.Parser._processFakeEndTag (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:663:10)
    at buttonStartTagInBody (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:1351:11)
    at buttonStartTagInBody (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:1352:9)
    at buttonStartTagInBody (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:1352:9)
    at buttonStartTagInBody (~/code/my_project/node_modules/node-readability/node_modules/parse5/lib/tree_construction/parser.js:1352:9)

Do you know why I might be getting this error? Is there a way to tell this library to stop attempting to parse the file, rather than blowing up? I can't seem to catch this error and let my script keep running.

Thanks!

@haroldtreen
Copy link
Collaborator

Looks like it's coming from parse5... stack trace doesn't suggest where in readability this is getting called... 🤔 .

Do you have the html you're trying to parse?

@brandonparsons
Copy link
Author

Unfortunately not. I was going through thousands of URLs, and everything is async so I can't grab which one it was :)

@vladat
Copy link

vladat commented Jun 26, 2020

I'm experiencing the same issue while trying to parse this URL: https://www.salewa.com/men-trekking-hiking-shoes

RangeError: Maximum call stack size exceeded
    at get (internal/bootstrap/pre_execution.js:295:8)
    at debug (/Users/backup/Projects/sampleproject/server/node_modules/node-readability/node_modules/request/lib/debug.js:5:26)
    at IncomingMessage.<anonymous> (/Users/backup/Projects/sampleproject/server/node_modules/node-readability/node_modules/request/request.js:745:5)
    at IncomingMessage.emit (events.js:215:7)
    at IncomingMessage.EventEmitter.emit (domain.js:476:20)
    at IncomingMessage.<anonymous> (/Users/backup/Projects/sampleproject/server/node_modules/node-readability/node_modules/request/request.js:950:39)
    at IncomingMessage.emit (events.js:210:5)
    at IncomingMessage.EventEmitter.emit (domain.js:476:20)
    at IncomingMessage.<anonymous> (_http_client.js:368:14)
    at IncomingMessage.emit (events.js:215:7)
    at IncomingMessage.EventEmitter.emit (domain.js:476:20)
    at IncomingMessage.<anonymous> (/Users/backup/Projects/sampleproject/server/node_modules/node-readability/node_modules/request/request.js:950:39)
    at IncomingMessage.emit (events.js:210:5)
    at IncomingMessage.EventEmitter.emit (domain.js:476:20)
    at IncomingMessage.<anonymous> (_http_client.js:368:14)
    at IncomingMessage.emit (events.js:215:7)
    at IncomingMessage.EventEmitter.emit (domain.js:476:20)
    at IncomingMessage.<anonymous> (/Users/backup/Projects/sampleproject/server/node_modules/node-readability/node_modules/request/request.js:950:39)
    at IncomingMessage.emit (events.js:210:5)
    at IncomingMessage.EventEmitter.emit (domain.js:476:20)
    at IncomingMessage.<anonymous> (_http_client.js:368:14)
    at IncomingMessage.emit (events.js:215:7)

@vladat
Copy link

vladat commented Jun 27, 2020

I did some investigation and it seems to be a known issue with the request package:
request/request#2008
yarnpkg/yarn#7542 <= bugfix proposed here seems to work in my case

However request package is now fully deprecated so we shouldn't expect this to be fixed on their side.

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