TFS (vNext) + Karma + Chrome : Chrome have not captured in 60000 ms, killing - google-chrome

I am trying to build our team's UI through TFS 2015(vNext) on premises builds.
I am using Grunt build step in vNext to call a gruntjs file which will build all the grunt tasks.
Currently,the build is failing because of the task is not able to Start chrome and is timing out "Chrome have not captured in 60000 ms, killing." I see it is able to start chrome for some grunt tasks but fails for some. When I run the grunt command directly calling the gruntjs file from cmdline or powershell console on the build server, it works perfectly fine but it fails from the vNext builds.
I rolled back the chrome version to "51.0.2704.103 m" from "52.0.2743.116 m" and tried but still no success.
I went through the links which discuss the same issue. But I am not sure if this is a chrome issue as it works for some grunt tasks.
I am stuck with this since past week and on the verge of giving up, any help will be really great.
Thanks
ERROR
[32m31 08 2016 11:27:53.800:INFO [karma]: [39mKarma v0.13.22 server started at http://localhost:8888/
[32m31 08 2016 11:27:53.815:INFO [launcher]: [39mStarting browser Chrome
[33m31 08 2016 11:28:49.663:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:28:49.757:INFO [launcher]: [39mTrying to start Chrome again (1/2).
[33m31 08 2016 11:28:53.834:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:28:53.912:INFO [launcher]: [39mTrying to start Chrome again (1/2).
[33m31 08 2016 11:29:49.779:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:29:49.842:INFO [launcher]: [39mTrying to start Chrome again (2/2).
[33m31 08 2016 11:29:53.931:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:29:53.993:INFO [launcher]: [39mTrying to start Chrome again (2/2).
[33m31 08 2016 11:30:49.852:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[31m31 08 2016 11:30:49.930:ERROR [launcher]: [39mChrome failed 2 times (timeout). Giving up.
[33mWarning: Task "karma:ci" failed. Use --force to continue.[39m
[31mAborted due to warnings.[39m
[33mWarning: Use --force to continue.[39m
[31mAborted due to warnings.[39m
Grunt failed with error: C:\Users\user1\AppData\Roaming\npm\grunt.cmd failed with return code: 6

this worked for me:
1) install puppeteer
npm install puppeteer --save-dev
2) add this code to karma conf at the very top of your module exports function:
const puppeteer = require('puppeteer');
process.env.CHROME_BIN = puppeteer.executablePath();
3) disable chrome sandbox:
browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}

I can reproduce your issue and fixed it by launching Chrome with "nosandbox".
Use following configuration in your karma project.conf.js:
browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}

Related

Jenkins not starting or coming back online - HANGING and showing SEVERE: Unable to parse provided JSON - [/var/lib/jenkins/cb-envelope/envelope.json]

Jenkins: 2.89.4-x rolling version
Jenkins was running slow due to memory issues.
Restarted Jenkins (sudo/usual way), I got the following SEVERE issue.
Finally Restarted Jenkins machine thinking that'll help; got memory back (mem looks good now).
Trying to start Jenkins again and getting the same SEVERE issue and installation just HANGS at a given plugin while doing Initializing plugin <somePlugin-here> by pool-6-thread-2.
Running from: /usr/lib/jenkins/jenkins.war
Jun 06, 2019 6:49:14 AM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war
Jun 06, 2019 6:49:14 AM org.eclipse.jetty.util.log.Log initialized
..
...more lines here...
...
..
Jun 06, 2019 6:49:19 AM jenkins.model.Jenkins$5 runTask
INFO: Took 54ms for LogRecorderManager.init by pool-6-thread-7
Jun 06, 2019 6:49:19 AM com.cloudbees.jenkins.plugins.updates.envelope.LoggerLog log
SEVERE: Unable to parse provided JSON
net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of
at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:499)
at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:919)
at net.sf.json.JSONObject._fromString(JSONObject.java:1145)
at net.sf.json.JSONObject.fromObject(JSONObject.java:162)
at net.sf.json.JSONObject.fromObject(JSONObject.java:132)
at com.cloudbees.jenkins.plugins.updates.envelope.JSONObjectLoader.from(JSONObjectLoader.java:38)
at com.cloudbees.jenkins.plugins.updates.envelope.JSONObjectLoader$1.apply(JSONObjectLoader.java:51)
at com.cloudbees.jenkins.plugins.updates.envelope.JSONObjectLoader$1.apply(JSONObjectLoader.java:47)
at com.cloudbees.jenkins.plugins.updates.envelope.Validation$Value.flatMap(Validation.java:229)
at com.cloudbees.jenkins.plugins.updates.envelope.JSONObjectLoader.from(JSONObjectLoader.java:47)
at com.cloudbees.jenkins.plugins.updates.envelope.ParsedEnvelope$Loader.fromJSON(ParsedEnvelope.java:95)
at com.cloudbees.jenkins.cjp.installmanager.BaseFolder.loadInstalled(BaseFolder.java:136)
at com.cloudbees.jenkins.cjp.installmanager.WAREnvelope.loadInstalled(WAREnvelope.java:140)
at com.cloudbees.jenkins.cjp.installmanager.CJPPluginManager$StartUp.execute(CJPPluginManager.java:297)
at com.cloudbees.jenkins.cjp.installmanager.CJPPluginManager.loadPlugins(CJPPluginManager.java:231)
at com.cloudbees.jenkins.cjp.installmanager.CJPPluginManager.loadBundledPlugins(CJPPluginManager.java:209)
at hudson.PluginManager$1$1.run(PluginManager.java:379)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1066)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Jun 06, 2019 6:49:19 AM com.cloudbees.jenkins.plugins.updates.envelope.LoggerLog log
SEVERE: Unable to read JSON from [/var/lib/jenkins/cb-envelope/envelope.json]
Jun 06, 2019 6:49:19 AM jenkins.model.Jenkins$5 runTask
..
..
..
..
..
...more lines here...regarding inspecting/installing/loading/extracting plugins .hpi/.jpi files (looks good no ERROR/FATAL/SEVERE lines in this area).
...
..
..
..
..
..
Jun 06, 2019 6:49:34 AM jenkins.model.Jenkins$5 runTask
INFO: Took 0ms for Initializing plugin ColumnPack-plugin by pool-6-thread-2
Jun 06, 2019 6:49:34 AM jenkins.model.Jenkins$5 runTask
INFO: Took 274ms for Discovering plugin initialization tasks by pool-6-thread-10
Jun 06, 2019 6:49:34 AM jenkins.model.Jenkins$5 runTask
INFO: Took 0ms for SupportPlugin.threadDumpStartup by pool-6-thread-15
Jun 06, 2019 6:49:34 AM jenkins.model.Jenkins$5 runTask
INFO: Took 2ms for XStreamDOMCompat.addAliases by pool-6-thread-16
The above log shows only has 1 SEVERE error about the following:
SEVERE: Unable to parse provided JSON - [/var/lib/jenkins/cb-envelope/envelope.json]
Questions:
1. What is this cb-envelop folder in JENKINS_HOME?
2. Why Jenkins is not coming up?
I see this folder has 0 byte envelop.json file and both cje-xx folders contain nothing, example ls output shown below.
[giga123#jenkins_dev_machine ~]$ ls -l /var/lib/jenkins/cb-envelope/
total 8
drwxr-xr-x 2 jenkins_svc_user jenkins_group 4096 Jul 3 2017 cje-2.46.3.2
drwxr-xr-x 2 jenkins_svc_user jenkins_group 4096 Apr 20 2018 cje-2.89.4.2
-rw-r--r-- 1 jenkins_svc_user jenkins_group 0 Mar 27 2018 envelope.json
-rw-r--r-- 1 jenkins_svc_user jenkins_group 0 Jul 5 2017 envelope.json.disabled
[giga123#jenkins_dev_machine ~]$ ls -l /var/lib/jenkins/cb-envelope/cje-2.89.4.2/
total 0
Solution:
Soft fix: Renamed the envelop.json file to envelop.json.disabled.
Try Jenkins start now (ex: sudo /sbin/service jenkins stop/start and after start Jenkins should come up fine. Didn't catch that this issue came sometime back and someone did disable this file for Jenkins to startup.
The issue was a BLANK json file (thus '{' parse SEVERE error was coming up).
Hard fix: Rename /var/lib/jenkins/cb-envelope/ to /var/lib/jenkins/cb-envelope.OLD
Try Jenkins start now (ex: sudo /sbin/service jenkins stop/start and after start Jenkins should come up fine. cb-envelop folder will be recreated (if renamed/deleted) after Jenkins start.
Once this was done net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of error went away and Jenkins installation went a little further BUT installation halted at a given plugin. I disabled that plugin (by going to $JENKINS_HOME/plugins/<plugin.jpi_or_hpi>.disabled and retried to start Jenkins, now it halted at another next plugin in the list of plugins during Initializing plugin .... plugin... steps/sub-steps.
To resolve that, we had to contact Cloudbees support team and disable support-core.jpi plugin. This plugin comes with Cloudbees Jenkins Operation Center / Master installation by default as one of the .jpi files.
After support-core.jpi file in plugins folder was renamed to support-core.jpi.disabled (you can move support-core folder to support-core.OLD if you want), we retried starting Jenkins and it came back up fine.
One last thing we noticed was, after Jenkins dashboard was finally UP, it was in QUITE and SHUTDOWN mode (by design). To remove state that, we had to click on:
As an admin level user account, Go to Jenkins > Manage Jenkins > Quiet Restart and UN-CHECK the check box which says Stay in "queiting down" state when restarted.
Remove the check from the following.
On Jenkins dashboard, click cancel on Shut down mode link (if any) and now Jenkins is up and running fine.

IBM APIC starting loopback

I am new to API Connect, and I have installed npm, node and apic in my local MacBook. Now I have created a loopback directory and trying to run the loopback application using apic Start. However, I am not understanding the error received from the logs:
MacBook-Pro-2:socialreviews Work$ apic start
Error: Service socialreviews started but did not initialize within the timeout period. Dumping log buffer.
[Tue Apr 30 12:02:42 2019] com.ibm.diagnostics.healthcenter.loader INFO: Node Application Metrics 3.1.3.201810251210 (Agent Core 3.2.6)
[Tue Apr 30 12:02:42 2019] com.ibm.diagnostics.healthcenter.mqtt INFO: Connecting to broker localhost:1883
strong-supervisor attaching dashboard at /appmetrics-dash
2019-04-30T09:02:42.694Z pid:44844 worker:0 INFO supervisor starting (pid 44844)
2019-04-30T09:02:42.697Z pid:44844 worker:0 INFO supervisor reporting metrics to internal:
2019-04-30T09:02:42.709Z pid:44844 worker:0 INFO supervisor size set to undefined
2019-04-30T09:02:42.905Z pid:44848 worker:1 [Tue Apr 30 12:02:42 2019] com.ibm.diagnostics.healthcenter.loader INFO: Node Application Metrics 3.1.3.201810251210 (Agent Core 3.2.6)
2019-04-30T09:02:42.959Z pid:44848 worker:1 [Tue Apr 30 12:02:42 2019] com.ibm.diagnostics.healthcenter.mqtt INFO: Connecting to broker localhost:1883
2019-04-30T09:02:42.995Z pid:44848 worker:1 strong-supervisor attaching dashboard at /appmetrics-dash
2019-04-30T09:02:45.017Z pid:44848 worker:1 Web server listening at: http://0.0.0.0:4004
2019-04-30T09:24:29.148Z pid:44844 worker:0 WARN received SIGTERM, shutting down
2019-04-30T09:24:29.148Z pid:44844 worker:0 INFO supervisor size set to undefined
2019-04-30T09:24:29.148Z pid:44844 worker:0 INFO supervisor stopped
Can someone help me with this issue please?
This issue is solved, however I am not 100% sure what was the exact issue. What I have done is ran apic edit command then when clicking on start it suddenly asked me to install docker. I have done so, then I started to have readable errors of some packages not installed. So I used npm commands to install them and my issue is fixed now! :)

Karma cannot connect to Chrome in Windows 7

karma start Launches Chrome with correct URL but Chrome just sits there and spins. Also, no other url will work in that window that Karma launched.
Same behavior with Canary
Similar issue with FireFox
Opera and IE work!
if I copy/paste the URL into a functioning Chrome browser, it CONNECTS but after the original test window times out the server shuts down
For some reason I cannot launch Chrome with the user-data flag: --user-data-dir=C:\tmp\karma-7572069 -- it's the same behavior... the browser just spins and no other url works in that window
deleted all user profiles in Chrome & Firefox and re-installed them both... no go
ANY SUGGESTIONS?
After googling and pouring over umpteen similar SO issues I thought for sure it had to do with a corrupt user profile... but after wiping the Chrome user folder and re-installing etc, what else could I try?
Karma: 0.12.28
Chrome: 39.0.2171.95 m
Windows 7
debug log:
DEBUG [config]: Loading config d:\Code\test2\karma.conf.js
DEBUG [plugin]: Loading karma-* from d:\Code\test2\node_modules
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-firefox-launcher.
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-ie-launcher.
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-opera-launcher.
INFO [karma]: Karma v0.12.28 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [temp-dir]: Creating temp dir at C:\tmp\karma-7572069
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\tmp\karma-7572069 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=7572069
DEBUG [watcher]: Resolved files:
d:/Code/test2/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
d:/Code/test2/node_modules/karma-jasmine/lib/boot.js
d:/Code/test2/node_modules/karma-jasmine/lib/adapter.js
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\tmp\karma-7572069
INFO [launcher]: Trying to start Chrome again (1/2).
DEBUG [launcher]: Restarting Chrome
DEBUG [temp-dir]: Creating temp dir at C:\tmp\karma-7572069
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\tmp\karma-7572069 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=7572069
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\tmp\karma-7572069
INFO [launcher]: Trying to start Chrome again (2/2).
DEBUG [launcher]: Restarting Chrome
DEBUG [temp-dir]: Creating temp dir at C:\tmp\karma-7572069
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\tmp\karma-7572069 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=7572069
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\tmp\karma-7572069
ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.
DEBUG [launcher]: Disconnecting all browsers
Figured it out. My console was being run as a non-admin. Booo. Now everything works.

karma + Chrome not working after last auto-update of Chrome

We use jenkins with a number of jenkins slave nodes running on Windows 7. Through jenkins we kick off karma tests to be run on the slave node to run our jasmine tests on the actual browsers. Suddenly last week after Chrome auto-updated to version "38.0.2125.104 m" this stopped working (karma unable to capture the browser). Here are our logs:
[INFO] --- maven-karma-plugin:1.8:start (default-cli) # module-translation ---
[INFO] Executing Karma Test Suite ...
[INFO] cmd /C karma start C:\dev\util\jenkinsMaster\workspace\ci_module_translation_browser\translation\target\test-classes\frontend\thirdParty\js\com\verisk\underwriting\config\karma-config-module\1.0.3\karma-config-module-1.0.3.js --browsers Chrome --single-run
INFO [karma]: Karma v0.12.5 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again (1/2).
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again (2/2).
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.
When running locally, the same command (using the karma-maven-plugin) works just fine. The karma plugin just runs the karma executable installed separately (which also works when run locally). Additionally, other browsers work when kicked off from jenkins. They have been working for quite some time now, along with Chrome (until this last update from Chrome). It is only the combination of the three: jenkins + karma + Chrome that is resulting in this issue.
Since Chrome has made it as hard as possible to get an older version, this has been very hard to test or resolve. Everything seems to be pointing to the current version of Chrome as the culprit.
Has anyone else seen this or have a solution?
The fix has been merged into Chromium. The fix is now available through a regular update of Chrome. This works for version Chrome 39.0.2171.

what happened when set jruby min runtime?

I am now struggle on Jruby on Rails. We did not config the min/max jruby runtime before, the portal works well.
In these days, i found that set these config will improve our portal's performance, so I decide to config it in this way:
config.webxml.jruby.min.runtimes = 2
config.webxml.jruby.max.runtimes = 4
However, we portal can not boot up after i setting this, the log continue throw the java class can not found error:
INFO: Info: received max runtimes = 4
Dec 19, 2012 1:57:18 PM org.apache.catalina.core.ApplicationContext log
INFO: Info: received min runtimes = 2
Dec 19, 2012 1:57:18 PM org.apache.catalina.core.ApplicationContext log
INFO: Info: received max runtimes = 4
Dec 19, 2012 1:57:18 PM org.apache.catalina.core.ApplicationContext log
INFO: An exception happened during JRuby-Rack startup
cannot link Java class com.portal.util.selector.SelectorUtil, probable missing dependency: Could not initialize class com.portal.util.selector.SelectorUtil
--- System
jruby 1.6.1 (ruby-1.8.7-p330) (2011-04-12 85838f6) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_35) [linux-amd64-java]
Time: Wed Dec 19 13:57:18 +0000 2012
Server: Apache Tomcat/6.0.35
jruby.home: file:/var/tomcat/webapps/ROOT/WEB-INF/lib/jruby-stdlib-1.6.1.jar!/META-INF/jruby.home
What is the difference when we set this min/max jruby runtime? Anyone can get me out of this?
Thanks in advance.
jruby thread safe comparison
in config/warbler.rb
config.webxml.jruby.min.runtimes = 1
config.webxml.jruby.max.runtimes = 1
and in config/environments/production.rb
config.threadsafe!