Friday, March 18, 2011

How to disable Windows Error Reporting on Windows 2008

Sometimes programs crash on Windows and we all know that Windows might asks us to report back to them or just for us to be notified that something did not work properly.
This is quite good for users but not for automating jobs on machines.

I was setting up a Windows 64-bit machine to run our Firefox builds and I noticed that every time we reached the "make -k check" step the job would hang until it timed out.
I decided to run the step manually and discovered that we would get a prompt for the user to intervene.
jsapi-tests.exe crashed when running "make -k check" and Windows notifies the user

At first ted let me know that it might be related to disabling the JIT debugger (Visual Studio allows you to attach a debugger on programs outside of itself just-in-time!) but I figured out that it was disabled and this was the "post attaching the debugger" message.

I filed a bug to disable the jsapi-tests.exe crash until it gets fixed but soon after I found a post that gave me an idea.
I searched for "prevent stopped working" and I noticed this low-rated comment on stackoverflow that mentions how to disable the "Windows Customer Experience Improvement Program".
This was not what I wanted but it inspired me to look for something that would stop Windows from notifying the users of an error.
I filtered for the word "Error" (because that is what you do on Administrative tools on Windows instead of searching). After looking for a while I found "Prevent display of the user interface for critical errors" and voila! It did the trick.

Here are the steps I followed which I documented on the Win64 reference platform documentation:
  • Run "gpedit.msc"
  • Computer configuration -> Administrative Templates
  • Windows Components -> Windows Error Reporting
  • Set "Prevent display of the user interface for critical errors" to Enabled
From now on this machine won't let the user know that a program crashed and will just carry on.

Happy Windows automation!

Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

How to install NSClient++ 0.3.8 on Windows 2008 x64 RC2

I am finally back to work on setting up the Windows 2008 64-bit machine to generate the 64-bit version of Firefox.

At Mozilla's Release Engineering we use Nagios to monitor our build and test machines (among other systems).
The NRPE addon (Nagios Remote Plugin Executor) is designed to allow you to execute Nagios plugins on remote Linux/Unix machines.
In the case of Windows we use NSClient++ which can be used for Nagios as its NRPE for Linux/Unix machines.

Therefore, for the Windows 64-bit machine I installed NSClient++ as we do for the Windows 32-bit machines (bhearsum did this long time ago and gave me a heads up from what he remembered - also thanks to ravi for checking things with me).

Enough background and let me show you what I did.

  • Download NSClient++ 0.3.8 for 64-bit machines
    • I am going to use the installer as it adds the firewall exceptions for me.
  • Start the installer and choose these settings:
    • "Enable common check plugins", "Enable nsclient server (check_nt)", "Enable NRPE Server (check_nrpe)", "Enable WMI checks"
  • Do not start the service and finish the installation
  • Rename C:\Program Files\NSClient++\NSC.ini as NSC.original.ini
  • Checkout mozilla/tools/nagios and copy NSC.ini to C:\Program Files\NSClient++
    • I am reusing the NSC.ini in our Win2k3 machines
    • In fact, the selected settings in the installation have no effect since we replace the NSC.ini but I thought you might be interested on having a rough idea on what to do yourself.
To check that everything went well do the following (from this documentation):
  • Run "C:\Program Files\NSClient++\nsclient++.exe" /test
  • We are going to run the following two checks (see at bottom of this post for output):
    • CheckDriveSize ShowAll MinWarnFree=10% MinCritFree=5% Drive=c:\
    • CheckCPU warn=80 crit=90 time=20m time=10s time=4
To check that everything works well from another machine do the following:
  • Add to allowed_hosts in C:\Program Files\NSClient++\NSC.ini the IP of a linux machine that has the nagios plugins installed
  • Reboot the Windows machine (we want to make sure that everything is on a clean state)
  • From the Linux machine do the following:
cd /usr/lib/nagios/plugins
./check_nrpe -H mw64-ix-slave01 -c check_load
CRITICAL: 1m: average load 0% > critical, 5m: average load 0% > critical, 15m: average load 0% > critical|'1m'=0%;0;0; '5m'=0%;0;0; '15m'=0%;0;0;
./check_nrpe -H mw64-ix-slave01 -c check_buildbot
OK: python.exe: 1
  • Now go back to the Windows machine and restore the allowed_hosts in NSC.ini to its original state
And that's it!
You can now use nagios with your Windows machine!

Here is the output of running |"C:\Program Files\NSClient++\nsclient++.exe" /test| and the two checks:
Launching test mode - client mode
d NSClient++.cpp(1178) Enabling debug mode...
d NSClient++.cpp(551) Attempting to start NSCLient++ - 2010-05-27
d NSClient++.cpp(969) Loading plugin: CheckDisk...
d NSClient++.cpp(969) Loading plugin: Event log Checker....
d NSClient++.cpp(969) Loading plugin: Helper function...
d NSClient++.cpp(969) Loading plugin: CheckSystem...
d NSClient++.cpp(969) Loading plugin: CheckWMI...
d \PDHCollector.cpp(73) Autodetected w2k or later, using w2k PDH counters.
d NSClient++.cpp(969) Loading plugin: File logger...
d \PDHCollector.cpp(110) Using index to retrive counternames
l \FileLogger.cpp(93) Log path is: C:\Program Files\NSClient++\\NSC.log
d NSClient++.cpp(969) Loading plugin: NRPE server (w/ SSL)...
d \NRPEListener.cpp(91) Loading all commands (from NRPE)
d \NRPEListener.cpp(121) Starting NRPE socket...
d \PDHCollector.cpp(130) Found countername: CPU:    \Processor(_total)\% Process
or Time
d \PDHCollector.cpp(131) Found countername: UPTIME: \System\System Up Time
d \PDHCollector.cpp(132) Found countername: MCL:    \Memory\Commit Limit
d \PDHCollector.cpp(133) Found countername: MCB:    \Memory\Committed Bytes
d NSClient++.cpp(969) Loading plugin: SystemTray...
d \Socket.h(669) Bound to:
e \SysTray.cpp(51) SysTray is not installed (or it cannot interact with the desk
top) SysTray won't be loaded. Run NSClient++ SysTray install to change this.
d NSClient++.cpp(671) NSCLient++ - 2010-05-27 Started!
l NSClient++.cpp(455) Using settings from: INI-file
l NSClient++.cpp(456) Enter command to inject or exit to terminate...
CheckDriveSize ShowAll MinWarnFree=10% MinCritFree=5% Drive=c:\
d NSClient++.cpp(1106) Injecting: CheckDriveSize: ShowAll, MinWarnFree=10%, MinC
ritFree=5%, Drive=c:\
d NSClient++.cpp(1142) Injected Result: OK 'OK: c:\: 19.3G'
d NSClient++.cpp(1143) Injected Performance Result: ''c:\ %'=49%;10;5; 'c:\'=19.
32G;3.74;1.87;0;37.47; '
OK:OK: c:\: 19.3G|'c:\ %'=49%;10;5; 'c:\'=19.32G;3.74;1.87;0;37.47;
CheckCPU warn=80 crit=90 time=20m time=10s time=4
d NSClient++.cpp(1106) Injecting: CheckCPU: warn=80, crit=90, time=20m, time=10s
, time=4
d NSClient++.cpp(1142) Injected Result: OK 'OK CPU Load ok.'
d NSClient++.cpp(1143) Injected Performance Result: ''20m'=4%;80;90; '10s'=23%;8
0;90; '4'=22%;80;90; '
OK:OK CPU Load ok.|'20m'=4%;80;90; '10s'=23%;80;90; '4'=22%;80;90;

Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

Thursday, March 10, 2011

Automated Firefox XP debug unit tests are now live

As of this morning, we now have automated debug unit tests for Windows XP :)
TBPL showing the row for XP debug unit tests

We now have all desktop platforms at parity.

This change was enabled in bug 614955 and again many thanks goes to ted for helping when I was almost loosing it.

Kudos goes to philor for checking that the results of the test runs were good.

Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.