OnetapInc / chromy

Chromy is a library for operating headless chrome. 🍺🍺🍺
MIT License
605 stars 41 forks source link

ChromyJS returned an unexpected error while attempting to capture a selector. #62

Open ryuran opened 6 years ago

ryuran commented 6 years ago

Hello

I play with backstopJS and chromy seems to bug sometimes.

Maybe It’s because I try to find a only one selector and it’s not present in the tested page.

ChromyJS returned an unexpected error while attempting to capture a selector. Error: not opened
    at WebSocket.send (/home/travis/build/20minutes/colette/node_modules/ws/lib/WebSocket.js:356:18)
    at Chrome.enqueueCommand (/home/travis/build/20minutes/colette/node_modules/chrome-remote-interface/lib/chrome.js:115:16)
    at /home/travis/build/20minutes/colette/node_modules/chrome-remote-interface/lib/chrome.js:79:28
    at Promise (<anonymous>)
    at Chrome.send (/home/travis/build/20minutes/colette/node_modules/chrome-remote-interface/lib/chrome.js:78:16)
    at Object.handler [as evaluate] (/home/travis/build/20minutes/colette/node_modules/chrome-remote-interface/lib/api.js:32:23)
    at Chromy._callee$ (/home/travis/build/20minutes/colette/node_modules/chromy/dist/document.js:400:81)
    at tryCatch (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as next] (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:117:21)
    at tryCatch (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:65:40)
    at invoke (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:155:20)
    at /home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:198:11
    at Promise (<anonymous>)
    at callInvokeWithMethodAndArg (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:197:16)
    at AsyncIterator.enqueue [as _invoke] (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:220:13)

You can se the log of the test here: https://travis-ci.org/20minutes/colette/jobs/267365456

dotneet commented 6 years ago

Hi @ryuran, This test seems to open the many ports. Would the test be failed even if it is small test?

ryuran commented 6 years ago

I will try.

ryuran commented 6 years ago

@dotneet It seems OK with only one test. Maybe I should use a limit of concurrent test with backstop.js. https://github.com/garris/BackstopJS#capturing-screens-in-parallel

ryuran commented 6 years ago

@dotneet I try to limit async test with backstop but this problem still here. garris/BackstopJS#537

mike-malandra commented 6 years ago

I'm also seeing this issue while running in docker on a linux container. I set the number of async captures to 1. After a while, the entire process just hangs and never exits without any other errors. This may need to be added to another issue, but I will start looking into how these threads are being created/cleaned up. it seems a thread is just locking and never cleaning up properly causing the entire run to just come to a halt.