karma-runner / karma-phantomjs-launcher

A Karma plugin. Launcher for PhantomJS.
MIT License
281 stars 131 forks source link

PhantomJS disconnecting because no message in 10000 ms when set to single-run #126

Open ciwchris opened 8 years ago

ciwchris commented 8 years ago

When running tests on our build servers on random runs, seemingly, no tests run and karma exits with the message:

Disconnected (1 times), because no message in 10000 ms.

So far I've only been able to reproduce this when using the --single-run option and only on our build servers, on my dev box I've never experienced this. Here's the version info on the servers:

Windows 2012 R2 node: v4.4.5 karma: v0.13.22 karma-phantomjs-launcher: 1.0.0 phantomjs-prebuilt: 2.1.7 PhantomJS: 2.1.1

On one build server it seems the tests run about 50% of the time, on the other server it's less than 10%. Also, if I set log-level=debug then it raises the percentage to successfully running over 90% of the time on both servers. Here's the debug info from a failed run (with names stripped):

[36m22 06 2016 15:38:40.946:DEBUG [config]: [39mautoWatch set to false, because of singleRun
[36m22 06 2016 15:38:40.962:DEBUG [plugin]: [39mLoading karma-* from C:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules
[36m22 06 2016 15:38:40.962:DEBUG [plugin]: [39mLoading plugin C:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules/karma-chrome-launcher.
[36m22 06 2016 15:38:40.977:DEBUG [plugin]: [39mLoading plugin C:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules/karma-growl-reporter.
[36m22 06 2016 15:38:40.977:DEBUG [plugin]: [39mLoading plugin C:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules/karma-jasmine.
[36m22 06 2016 15:38:40.977:DEBUG [plugin]: [39mLoading plugin C:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules/karma-phantomjs-launcher.
[36m22 06 2016 15:38:41.102:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.118:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.134:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.149:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.149:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.149:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.149:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.149:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.181:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[36m22 06 2016 15:38:41.227:DEBUG [watcher]: [39mExcluded file "C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…"
[32m22 06 2016 15:38:41.290:INFO [karma]: [39mKarma v0.13.22 server started at http://localhost:8080/
[32m22 06 2016 15:38:41.290:INFO [launcher]: [39mStarting browser PhantomJS
[36m22 06 2016 15:38:41.290:DEBUG [temp-dir]: [39mCreating temp dir at C:\Users\…\AppData\Local\Temp\5\karma-38961765
[36m22 06 2016 15:38:41.306:DEBUG [launcher]: [39mC:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe C:\Users\…\AppData\Local\Temp\5\karma-38961765/capture.js
[36m22 06 2016 15:38:42.724:DEBUG [web-server]: [39mserving: C:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules\karma\static/client.html
[36m22 06 2016 15:38:42.740:DEBUG [web-server]: [39mserving: C:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules\karma\static/karma.js
[36m22 06 2016 15:38:42.787:DEBUG [karma]: [39mA browser has connected on socket /#qjDg6OQAWpU_z-RYAAAA
[36m22 06 2016 15:38:42.802:DEBUG [web-server]: [39mupgrade /socket.io/?EIO=3&transport=websocket&sid=qjDg6OQAWpU_z-RYAAAA
[32m22 06 2016 15:38:42.829:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: [39mConnected on socket /#qjDg6OQAWpU_z-RYAAAA with id 38961765
[36m22 06 2016 15:38:42.830:DEBUG [launcher]: [39mPhantomJS (id 38961765) captured in 1.54 secs
[36m22 06 2016 15:38:42.832:DEBUG [phantomjs.launcher]: [39m

[36m22 06 2016 15:38:42.836:DEBUG [web-server]: [39mserving: C:\TeamCity\buildAgent\work\9be4dbed06b1d253\node_modules\karma\static/context.html
[36m22 06 2016 15:38:42.837:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?391e45351df9ee35392d2e5cb623221a969fc009 /
[36m22 06 2016 15:38:42.837:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
[36m22 06 2016 15:38:42.837:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
[36m22 06 2016 15:38:42.837:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/karma-jasmine/lib/boot.js?945a38bf4e45ad2770eb94868231905a04a0bd3e /
[36m22 06 2016 15:38:42.837:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/karma-jasmine/lib/boot.js
[36m22 06 2016 15:38:42.837:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/karma-jasmine/lib/boot.js
[36m22 06 2016 15:38:42.837:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/karma-jasmine/lib/adapter.js?7975a273517f1eb29d7bd018790fd4c7b9a485d5 /
[36m22 06 2016 15:38:42.837:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/karma-jasmine/lib/adapter.js
[36m22 06 2016 15:38:42.837:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253/node_modules/karma-jasmine/lib/adapter.js
[36m22 06 2016 15:38:42.837:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.837:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.837:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mRequesting /base/globals.js?6f656645199dd8e193689eb4f85d47ba8fbdc977 /
[36m22 06 2016 15:38:42.857:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.872:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.888:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.919:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [middleware:source-files]: [39mRequesting /absoluteC:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [middleware:source-files]: [39mFetching C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[36m22 06 2016 15:38:42.935:DEBUG [web-server]: [39mserving (cached): C:/TeamCity/buildAgent/work/9be4dbed06b1d253\…
[33m22 06 2016 15:38:52.830:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: [39mDisconnected (1 times), because no message in 10000 ms.

[36m22 06 2016 15:38:52.830:DEBUG [karma]: [39mRun complete, exiting.
[36m22 06 2016 15:38:52.830:DEBUG [launcher]: [39mDisconnecting all browsers
[36m22 06 2016 15:38:52.846:DEBUG [launcher]: [39mProcess PhantomJS exited with code 0
[36m22 06 2016 15:38:52.846:DEBUG [temp-dir]: [39mCleaning temp dir C:\Users\…\AppData\Local\Temp\5\karma-38961765
[36m22 06 2016 15:38:52.846:DEBUG [launcher]: [39mFinished all browsers

If I change the karma config on the build servers to use Chrome then the tests always run successfully. I've tried previous versions of karma-phantomjs-launcher and phantomjs-prebuilt, but I haven't noticed a difference. I'm not sure where to go from here.

boschni commented 8 years ago

Try to set karma's browserNoActivityTimeout setting, that worked for me: https://github.com/karma-runner/karma/blob/master/docs/config/01-configuration-file.md#browsernoactivitytimeout

ciwchris commented 8 years ago

@u-nikos thanks for the suggestion. I'll give it a try when I'm back next week.

zsims commented 8 years ago

Any luck? There's several issues raised around this. Most solutions seem to land on bump the retry count + timeout.

Wonder if this related to IPv6, as all the machines I've seen this on have localhost resolve to ::1.

ciwchris commented 8 years ago

@zsims, thanks for the bump.

I increased the timeout to 30 seconds and the issue persists.

[09:03:12][Karma] JavaScript Unit Tests (31s)
[09:03:13][JavaScript Unit Tests] 05 10 2016 09:03:13.020:INFO [karma]: Karma v0.13.22 server started at http://localhost:8080/
[09:03:13][JavaScript Unit Tests] 05 10 2016 09:03:13.027:INFO [launcher]: Starting browser PhantomJS
[09:03:14][JavaScript Unit Tests] 05 10 2016 09:03:14.740:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#sCHRWJMhhwxelX2JAAAA with id 52110227
[09:03:44][JavaScript Unit Tests] 05 10 2016 09:03:44.741:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (1 times), because no message in 30000 ms.
[09:03:44][JavaScript Unit Tests] 05 10 2016 09:03:44.742:ERROR [karma]: [TypeError: Cannot read property 'results' of undefined]
[09:03:44][JavaScript Unit Tests] TypeError: Cannot read property 'results' of undefined
[09:03:44][JavaScript Unit Tests]     at onBrowserComplete (C:\Tools\node_modules\karma-htmlfile-reporter\index.js:77:10)
[09:03:44][JavaScript Unit Tests]     at null.<anonymous> (C:\Tools\node_modules\karma\lib\events.js:13:22)
[09:03:44][JavaScript Unit Tests]     at emitOne (events.js:82:20)
[09:03:44][JavaScript Unit Tests]     at emit (events.js:169:7)
[09:03:44][JavaScript Unit Tests]     at null._onTimeout (C:\Tools\node_modules\karma\lib\browser.js:50:15)
[09:03:44][JavaScript Unit Tests]     at Timer.listOnTimeout (timers.js:92:15)
[09:03:44][JavaScript Unit Tests] node returned 1

localhost does resolve to ::1. Is there a solution, besides changing the machine's network settings?

SPSpwetter commented 7 years ago

browserDisconnectTolerance will cause it to attempt to reconnect, which is better than a timeout. Though your log is indicating something else.

chrstnbrn commented 7 years ago

I just had the same problem. It only occured on my continous integration server while working fine locally. I tried to increase the browserNoActivityTimeout but still no tests ran. I finally fixed this by removing the plugins property from my karma config.

jeffkynaston commented 7 years ago

Had the same issue today - worked locally on mac OSX sierra but ran into the error on our CI server (redhat) @chrstnbrn's suggestion fixed the problem for us

ciwchris commented 7 years ago

@chrstnbrn thanks for the suggestion, but we already don't have a plugins section in our config, neither when running locally or on our CI server.

zsims commented 7 years ago

Using Chrome instead of Phantom JS was the only way I was able to resolve this.

ghost commented 7 years ago

I have a similar issue which just started occurring today.

The tests start to run but then after a certain number of tests (it always looks to be around the same number) I get the [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Disconnected (1 times), because no message in 10000 ms. error.

All tests ran successfully a couple of days ago and haven't changed since.

It doesn't look like I'm running out of memory and I do have swap enabled.

bkardol commented 7 years ago

Running into a similar issue on our build agent on VSTS.

2016-12-02T14:56:22.1321710Z 02 12 2016 14:56:22.097:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#xRSfIrdCrG5KxvZYAAAD with id 76185905
2016-12-02T14:57:49.9471618Z 02 12 2016 14:57:49.801:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (3 times)
2016-12-02T14:57:49.9471618Z PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
2016-12-02T14:57:50.1791420Z   Disconnectedundefined
2016-12-02T14:57:50.3891269Z 
2016-12-02T14:57:50.7761042Z PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 0 of 0 DISCONNECTED (4 mins 34.906 secs / 0 secs)
2016-12-02T14:57:50.7761042Z 
2016-12-02T14:57:55.3168146Z npm ERR! Test failed.  See above for more details.
2016-12-02T14:57:56.8176705Z ##[error]npm failed with error: C:\Program Files\nodejs\npm.cmd failed with return code: 1

We have a couple of retries, but it disconnects every time. We added the following properties to the config file:

        browserNoActivityTimeout: 100000,
        browserDisconnectTolerance: 2
alex7egli commented 7 years ago

I had a similar issue on Windows 10, nodejs 4.6.1, karma 1.1.2, phantomjs-prebuilt: 2.1.8. I fixed it by changing my karma config preprocessors option from:

preprocessors: {
        'app/**/*.js': 'coverage'
    },

TO

preprocessors: {
        'app/!(bower_components)/**/*.js': ['coverage'] //track test coverage of our JS code
    },
ciwchris commented 7 years ago

@alex7egli thanks for the suggestion. I checked, we aren't using any preprocessors.

ErikSchierboom commented 7 years ago

I'm also having this problem. Excluding bower_components and jspm_packages didn't help. Strangely enough, if I pass --no-single-run, I don't get the timeouts.

Jossif commented 7 years ago

We are having the same issue running tests in Chrome on VSTS:

2016-12-19T17:29:42.4047493Z 19 12 2016 17:29:42.404:DEBUG [Chrome 50.0.2661 (Windows 10 0.0.0)]: Disconnected during run, waiting 2000ms for reconnecting. 2016-12-19T17:29:44.4219667Z 19 12 2016 17:29:44.421:WARN [Chrome 50.0.2661 (Windows 10 0.0.0)]: Disconnected (1 times) 2016-12-19T17:29:44.4219667Z Chrome 50.0.2661 (Windows 10 0.0.0) ERROR 2016-12-19T17:29:44.4219667Z Disconnectedundefined 2016-12-19T17:29:44.4219667Z Chrome 50.0.2661 (Windows 10 0.0.0) ERROR 2016-12-19T17:29:44.4219667Z Disconnectedundefined 2016-12-19T17:29:44.4219667Z Chrome 50.0.2661 (Windows 10 0.0.0): Executed 2575 of 2846 DISCONNECTED (52.986 secs / 40.396 secs) 2016-12-19T17:29:44.4219667Z Chrome 50.0.2661 (Windows 10 0.0.0): Executed 2575 of 2846 DISCONNECTED (52.986 secs / 40.396 secs)

timeouts are set in karma.conf.js to:

captureTimeout: 60000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 60000,

preprocessors are set to check only .js files in the app,

any suggestions ?

Ks89 commented 7 years ago

I have the same problem with Appveyor, but not on my mac.

zeevm commented 7 years ago

Same here: Using phantomjs locally works fine, on a VSTS CI server if I use single run it gets disconnected with no message error, if I don't use single run it works on the server but then the build plan is obviously stuck because karma didn't exit.

Anyone made any progress on that?

Ks89 commented 7 years ago

@zeevm exactly. You explained in a better way my problem XD

zeevm commented 7 years ago

Going deeper I've enabled all debugging options available and the scenario is always the same, karma serves all files to PhantomJS up to karma-test-shim.js and then the process gets stuck, I assume the browser stops responding and karma disconnects it after 10 seconds. It's always the same file that gets stuck karma-test-shim.js I've started adding tracing outputs in it to see where exactly it hangs in the file and turns out it's a nasty hisenbug, with the rightly places log messages in the file, the browser doesn't hang and the tests run properly, not entirely deterministic though, about 40-60% success.

rayzor65 commented 7 years ago

I still get the issue ("Disconnected (1 times), because no message in 10000 ms") after trying the following:

Increase browserNoActivityTimeout, waits longer but still dies Increase browserDisconnectTolerance, still dies at the same place Increase browserDisconnectTimeout singleRun true or false does not make a difference

Using phantomjs: 2.1.1 and karma-phantomjs-launcher: 1.0.0

I noticed that when I skipped a large chunk of tests they did run. It's not failing on a particular test my theory now it has something to do with the amount. Any suggestions what I can try? Tweak my VM perhaps?

rayzor65 commented 7 years ago

I managed to fix my issue by increasing the timeout of mocha. Hopefully this helps someone else! eg. client: { mocha: { timeout : 20000 } },

Ks89 commented 7 years ago

I still get the issue also with an higher timeout

bitencode commented 7 years ago

Just started having this same problem last week: phantomjs 2.1.1, karma 1.3.0, karma-phantomjs-launcher 1.0.0. I've tried most of the suggestions here, nothing has helped yet. Works fine on my mac, fails with the timeout message on our linux/Jenkins build system. [Sorry I'm not more helpful - if I find something, I'll add it here]

iheartpaypal commented 7 years ago

I was also running into this issue, and I discovered it was because I was (for some reason) missing the entry for localhost in my /etc/hosts file, which PhantomJS uses when it runs.

I added 127.0.0.1 localhost to my /etc/hosts, and it fixed this problem for me.

vinylhero commented 7 years ago

Short term fix as i'm also experiencing this issue, but try changing the port number you are using your karma tests on. I.e change

config.set ({
    port: 9876
});

I put mine to 9877 until it stopped working and then to 9878. This should work short term to get you working but need a proper fix

vinylhero commented 7 years ago

Changing the settings fixes the issue for a short period. I have changed port and log levels but both eventually fail again.

androticus commented 7 years ago

@iheartpaypal my hosts file already has entries for both 127.0.0.1 and ::1

@ErikSchierboom i tried the --no-single-run and that ran some of my tests (100/130), then the command line window just hung, no further progress no error

rupendra-sharma commented 7 years ago

Hi

I am getting the same issue with Chrome and Karma. 27 01 2017 15:01:51.287:WARN [Chrome 55.0.2883 (Windows 10 0.0.0)]: Disconnected (1 times), because no message in 1000000 ms.

Chrome 55.0.2883 (Windows 10 0.0.0): Executed 0 of 0 DISCONNECTED (16 mins 42.766 secs / 0 secs)

My config settings are: port: 9876, browserNoActivityTimeout: 1000000, captureTimeout: 1000000, autoWatch: false, browsers: ['Chrome'], singleRun: true

Execute Karma from command prompt: C:>/ node node_modules\karma\bin\karma start marilyn.conf.js --log-level warn --no-auto-watch > MyTestLog920TestCase.log Surprisingly it worked for 920 test files but not more than that.

I do not have any plugin statement.

developerX commented 7 years ago

@rupendra-sharma @androticus are you guys using ui-router? What my issue was that ui-router had updated to (1.0.0-rc.1) when doing an npm install and the tests started failing out. I then switched back to the previous version of ui-router and everything runs perfect again.

I hope this helps anyone else that runs into the same issue. I spent a lot of time tracking this down hahah

lbennett-stacki commented 7 years ago

I bumped into this issue today on GitLab CI.

It seems to be an issue with the phantomjs-prebuilt as it runs fine when installing the PhantomJS binary manually on the CI server (I used a docker image).

Update: Actually, I take that back. It works fine on node:7 but not node:alpine, so is probably underlying dependencies issue that isn't tracked with npm.

brunobastosg commented 7 years ago

I had this issue today on GitLab CI, but not on my dev machine.

The problem was that in my package.json I had:

"angular2-http-interceptor": "^1.2.3"

On my dev machine this resolved to version 1.2.7 when I first installed it, but on GitLab CI it resolved to version 1.6.6.

Removing the caret to lock the version solved it.

x1c0 commented 7 years ago

I also have the same issue... works locally, fails in our VSTS build agents:

PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 56 of 127 SUCCESS (0 secs / 24.701 secs) PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 57 of 127 SUCCESS (0 secs / 25.321 secs) WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (1 times) PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR Disconnectedundefined PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 57 of 127 DISCONNECTED (1 min 56.525 secs / 25.321 secs) PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 57 of 127 DISCONNECTED (1 min 56.525 secs / 25.321 secs)

jfongp commented 7 years ago

Same issue (works locally, disconnected in VSTS). I increased the following Timeouts to 200000ms and that resolved the problem. However, when I increased them to 999999ms, it ran into issues in VSTS (either kept disconnecting or took a very long time, e.g. 17 mins to run 35 tests).

I was thinking those Timeouts might need to be increased as the number of tests grows. Is this a wrong assumption? Is there a maximum limit for the Timeouts? Thanks.

--browserDisconnectTimeout --browserNoActivityTimeout --captureTimeout

GFoley83 commented 7 years ago

@jfongp I've pinpointed the issue to CPU performance in our dev setup. Build server runs fine when using PhantomJS on single run but when the same tests are run on any of the older development machines, CPU usages spikes to 100% and results in the disconnected error. Modifying browserDisconnectTimeout, browserNoActivityTimeout, captureTimeout etc. caused the tests to work sometimes but not reliably.

jfongp commented 7 years ago

@GFoley83, thanks for sharing the info. My tests are run on VSTS's VM and I don't know if there is a way to access the hardware for the VM. Like @zeevm has pointed out, it always gets stuck at the karma-test-shim file...

x1c0 commented 7 years ago

(first, sorry for late reply)

@niksy thanks for your input, we tried all your suggestions already:

Looks that after a certain number of tests it just disconnects without any apparent reason.. and as @GFoley83 pointed out, this can maybe be it, but I don't have access to the servers..

mitorez commented 7 years ago

I've been using browserDisconnectTolerance: 5 to correct this issue on our Windows Server VM.

x1c0 commented 7 years ago

AFAIK increasing this number will just try to run the tests again upon disconnect error. In our case, it's the same, it gets stuck around half of our tests.. and then just repeats Itself with the same behavior :/

mitorez commented 7 years ago

Yes, I understand what I did just increases the number of run attempts, but without a solution this what enabled me to make our build server functional. Setting the disconnect tolerance to 3 didn't work for me, but 5 did - haven't timed out and failed the build since.

paulbackhouse commented 7 years ago

I have this same issue. It is highly frustrating with the inconsistency here. Very difficult to replicate or even understand the core issue here.

I have Visual Studio Online. Using Karma and Jasmine. Single run mode is a persist problem. This is a bug in my opinion.

Locally, no problem, everything runs as expected.

My build steps include npm install. I have a build variable which did resolve this problem for all my project for like 5 days and then back to square one again.

Build Vairable: key: PHANTOMJS_BIN value: C:\NPM\Modules\PhantomJS.cmd

packages.json:

{
  "devDependencies": {
    "jasmine-core": "^2.5.2",
    "gulp": "^3.9.1",
    "karma": "^1.3.0",
    "karma-jasmine": "^1.0.2",
    "karma-phantomjs-launcher": "^1.0.2",
    "karma-trx-reporter": "^0.2.9"

  }
}

My gulp task:

var karma = require('karma');

gulp.task('Tests', function (done) {

    var server = new karma.Server({
        configFile: __dirname + '/karma.conf.js',
        hostname: '127.0.0.1',
        //autoWatch: false,
        singleRun: true
    }, function () {
// i do this to force the exit as another bug occurred in build environment and it wasn't exiting - related to karma socket
        process.exit(); 
        done();
    });
    server.start();
});

karma.config

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
      //basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
      frameworks: ['jasmine'],

      //plugins: ['karma-jasmine', 'karma-phantomjs-launcher', 'karma-trx-reporter'],

    // list of files / patterns to load in the browser
    files: [
      "Scripts/json2.min.js" ,
      "Scripts/modernizr-2.8.3.js" ,
      "Scripts/jquery-2.2.0.min.js" ,
      "Scripts/jquery-ui-1.11.4.min.js" ,
      "Scripts/bootstrap.min.js" ,
      "Scripts/moment-with-locales.min.js" ,
      "Scripts/jquery.validate.min.js" ,
      "Scripts/jquery.slimscroll.min.js" ,
      "Scripts/jquery.blockUI.js" ,
      "Scripts/toastr.min.js" ,
      "Scripts/sweetalert/sweet-alert.min.js" ,
      "Scripts/others/intro.js" ,
      "Scripts/others/spinjs/spin.js" ,
      "Scripts/others/spinjs/jquery.spin.js",
      "Scripts/others/datepicker/bootstrap-datepicker.js",
      "Scripts/highcharts/highcharts.js" ,
      "Scripts/angular.min.js" ,
      "Scripts/angular-mocks.js" ,
      "Scripts/angular-animate.min.js" ,
      "Scripts/angular-cookies.min.js",
      "Scripts/angular-sanitize.min.js",
      "Scripts/angular-route.min.js" ,
      "Scripts/angular-ui-router.min.js" ,
      "Scripts/angular-highcharts.js" ,
      "Scripts/angular-ui/ui-bootstrap.min.js" ,
      "Scripts/angular-ui/ui-bootstrap-tpls.min.js" ,
      "Scripts/angular-ui/ui-utils.min.js" ,
      "Abp/Framework/scripts/abp.js" ,
      "Abp/Framework/scripts/libs/abp.jquery.js" ,
      "Abp/Framework/scripts/libs/abp.toastr.js" ,
      "Abp/Framework/scripts/libs/abp.blockUI.js" ,
      "Abp/Framework/scripts/libs/abp.spin.js" ,
      "Abp/Framework/scripts/libs/abp.sweet-alert.js" ,
      "Abp/Framework/scripts/libs/angularjs/abp.ng.js" ,
      "Scripts/jasmine/dynamicMocks/*.js" ,
      "Scripts/jasmine/test.util.js",
      "Common/Scripts/*.js",
      "App/main/**/*.js" 
    ],

    // list of files to exclude
    exclude: [
    ],

    proxies: {
        // app tries to get session, always returns 404 warning (even with whenPOST defined)
        // this ensures a response is valid for the request
        '/api/services/app/session/GetCurrentLoginInformations': 'http://127.0.0.1:9876/context.html'
    },

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress', 'trx'],

    trxReporter: { outputFile: '../JS-Test-Results.trx' },

    hostname: 'localhost',

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['PhantomJS'],
    //browsers: ['chrome'],
    //browsers: ['IE'],
    //browsers: ['firefox'],
    //browsers: ['safari'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: 1,

    browserNoActivityTimeout: 60000,
    captureTimeout: 60000,

    // to avoid DISCONNECTED messages
    //browserDisconnectTimeout : 30000, // default 2000
    //browserDisconnectTolerance : 1, // default 0
  })
}

I have tried multiple combinations and settings, this is the best I have so far and now its stopped working for no apparent reason :S

ArielCabib commented 7 years ago

We solved this issue by updating "karma-phantomjs-launcher": "^1.0.4", in the package.json

prakarangs commented 7 years ago

I had the same issue. However, adding browserNoActivityTimeout: 100000 in karmar.config fixed the issue for us.

giniedp commented 7 years ago

Same issue here. Happens only on CI machine. Here the first disconnect happens always before any test is run 100% of the time. Increasing browserDisconnectTolerance seemed to help at first, because on second attempt tests begin to run. But then the disconnect happens randomly.

My current fix is to split the tests into several CI tasks so the number of tests being run in one command is decreased. The initial disconnect still happens. But the tasks now have a higher chance to pass but it still is fragile.

terencechow commented 7 years ago

Not sure if this is related to everyone's problems but according to this issue, phantomjs-prebuilt will hang in an alpine environment because it is compiled for glibc environments but Alpine is a musl environment.

tomsaleeba commented 7 years ago

I've found that my tests were working on Karma 1.5 but getting this error with Karma 1.6. Going back to 1.5 is a workaround that works for me (until I have to upgrade of course). I'm running the same versions of karma-jasmine, karma-phantomjs-launcher and karma-requirejs between both versions, it's only changing Karma that matters.

PS. I know this isn't relevant to the OP but it might help others.

mazhisai commented 7 years ago

I am running into the exact same issues. what used to be a random occurrence is happening consistently on all our runs blocking check-ins. I believe I managed to find a workaround using these settings

// on disconnect, makes karma to launch another phantonJs window to restart the testcases browserDisconnectTolerance: 5,

// these settings help reduce the timeouts to begin with. browserNoActivityTimeout: 60000, browserDisconnectTimeout: 30000, captureTimeout: 60000,

based on the test cases I deal with these settings work for me. you will notice warning messages similar to the following. this helped me tweak the numbers. YMMV.

14 04 2017 17:48:46.514:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (1 times), because no message in 60000 ms.

All said, this is a real issue and I wish there is a better fix for the problem.

I also tried with Chrome and noticed that a) didn't face any such issues in chrome b) it was much faster to execute the test cases in Chrome than phantomJs.

however since I cant use chrome on my build machine, I am struck with this option. if there is a better alternative I am missing, please advice.

for the record, these are the versions I use.

"karma": "1.6.0", "karma-chrome-launcher": "2.0.0", "karma-coverage": "1.1.1", "karma-jasmine": "1.1.0", "karma-junit-reporter": "1.2.0", "karma-mocha-reporter": "2.2.2", "karma-phantomjs-launcher": "1.0.4", "karma-sourcemap-loader": "0.3.7", "karma-webpack": "1.8.0",

I bumped up the version from 1.5.0 to 1.6.0 just today after I started seeing the issues. that didn't help in anyway.

Also on a unrelated note, when I switched to using Chrome, it reported 17 failing tests. PhantomJs never reported those and I have CI builds succeeding for the last few weeks with those failing tests. I have no idea how this happened, still confused.

thanks!

mazhisai commented 7 years ago

I had one freaking successful run and its broken again

niemyjski commented 7 years ago

I also randomly see this on our appveyor builds. I've tried the work arounds with no luck

henebb commented 7 years ago

As per @vinylhero workaround with changing ports, I added this in a gulp task: port: Math.floor((Math.random() * 500) + 9500); This way we always get a new fresh port :)

paulbackhouse commented 7 years ago

This to me suggests its buggy - the workarounds are not real solution and merely a treatment for a version released which ironically aimed for testing clearly hasn't been tested well enough its self :S