phantomjs icon indicating copy to clipboard operation
phantomjs copied to clipboard

Crash while parsing JSON command

Open adek05 opened this issue 10 years ago • 3 comments

Backtrace

{"id":"24cc8dda5d1983c21d5ff1fb5f1470f6","target":"page$ac1b788632cd57ac91c222ca40f42df8","name":"invokeMethod","params":["evaluate",null],"response":{"0":{"ALLOW_KEYBOARD_INPUT":1,"ATTRIBUTE_NODE":2,"CDATA_SECTION_NODE":4,"COMMENT_NODE"
:8,"DOCUMENT_FRAGMENT_NODE":11,"DOCUMENT_NODE":9,"DOCUMENT_POSITION_CONTAINED_BY":16,"DOCUMENT_POSITION_CONTAINS":8,"DOCUMENT_POSITION_DISCONNECTED":1,"DOCUMENT_POSITION_FOLLOWING":4,"DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC":32,"DOCUME
NT_POSITION_PRECEDING":2,"DOCUMENT_TYPE_NODE":10,"ELEMENT_NODE":1,"ENTITY_NODE":6,"ENTITY_REFERENCE_NODE":5,"NOTATION_NODE":12,"PROCESSING_INSTRUCTION_NODE":7,"TEXT_NODE":3,"accessKey":"","addEventListener":null,"align":"","appendChild":
null,"attributes":{"0":{"ATTRIBUTE_NODE":2,"CDATA_SECTION_NODE":4,"COMMENT_NODE":8,"DOCUMENT_FRAGMENT_NODE":11,"DOCUMENT_NODE":9,"DOCUMENT_POSITION_CONTAINED_BY":16,"DOCUMENT_POSITION_CONTAINS":8,"DOCUMENT_POSITION_DISCONNECTED":1,"DOCUM
ENT_POSITION_FOLLOWING":4,"DOCUMENT_POSITION_IMPLEMENTATION_SP

SyntaxError: Unexpected end of JSON input
    at Object.parse (native)
    at Liner.<anonymous> (/usr/src/app/node_modules/phantom/lib/phantom.js:144:36)
    at emitOne (events.js:96:13)
    at Liner.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Liner.Readable.push (_stream_readable.js:134:10)
    at Liner.Transform.push (_stream_transform.js:128:32)
    at Liner.flush [as _flush] (/usr/src/app/node_modules/linerstream/index.js:26:10)
    at Liner.<anonymous> (_stream_transform.js:118:12)
    at Liner.g (events.js:291:16)

I do not have a solid repro now. Happens intermittently, looks like for some reason there is a newline midway through the command and Liner breaks it there, which causes invalid JSON. For now, I will start catching exceptions there and try to see if indeed there is a continuation in the next line or whether it's PhantomJS crashing or anything along those lines.

Environment

OS: Docker image node:6.9-slim based on Debian Phantom: 2.1.21 (npm install phantomjs)

adek05 avatar Oct 30 '16 17:10 adek05

I'm getting the same issue. Any advises ?

cuongsimplypost avatar Mar 25 '17 08:03 cuongsimplypost

It was OOM in my case. Bumping memory limit and adding swap memory helped in my case.

adek05 avatar Jun 04 '17 16:06 adek05

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

stale[bot] avatar Dec 29 '19 09:12 stale[bot]