Getting Useful Error Messages on Linux

Post Reply
Masher
Site Admin
Posts: 3612
Joined: Thu Apr 20, 2006 2:54 pm
Location: America's Heartland
Contact:

Getting Useful Error Messages on Linux

Post by Masher »

Mono disables debugging by default, which is not useful if the software throws an error. There are typically multiple things that need to be done to get useful error messages.

If you get stack traces that end with :0, these procedures will assist with getting meaningful crash messages. For example we don't want

Code: Select all

at btnException_Click (System.Object sender, System.EventArgs e) [0x00001] in <6ab75a45693043979bfe11c8a176dafb>:0 
We'd rather see

Code: Select all

at btnException_Click (System.Object sender, System.EventArgs e) [0x00001] in admininfo.aspx.cs:251 
Please note paths may vary depending on your install location, type and distribution.

Web Panel
  • Edit Web.config in the root of the web panel (i.e. /var/www/html/Web.config)
  • Look for the <customErrors mode="RemoteOnly"> and change RemoteOnly to Off
  • cd to the Web panel root/bin folder (i.e. /var/www/html/bin)
  • Run pdb2mdb <file.dll> for at least UGCC.dll and MashToolsSharp.dll (i.e. pdb2mdb UGCC.dll and pdb2mdb MashToolsSharp.dll).
    • This converts Microsoft's debug information into mono's format, without this line numbers aren't returned in stack traces.
  • For Apache
    • Edit /etc/httpd/conf.d/mod_mono.conf and add MonoDebug true
    • Restart apache
  • For xsp
    • Run xsp with: MONO_OPTIONS=--debug xsp4
The 'About UGCC' page in Settings has a test exceptions button you can use to throw a test exception to ensure it's working properly. You should see a file name and a number at the end of the line (see example above).

Monitor
  • cd to the monitor folder (i.e. /ugcc/mon)
  • Run pdb2mdb <file.dll/file.exe> for ugccmonsvc.exe and MashToolsSharp.dll
  • Edit your systemd unit file (/etc/systemd/system/ugccmon.service) to include --debug after mono-sgen on the ExecStart= line, also add a new line to the [Service] section: Environment=MONO_OPTIONS=--debug (if you already have an Environment= line, it's fine; multiple Environemnt lines are fine).
  • If not using systemd to manage the monitor, edit your monitor start up script to include MONO_OPTIONS=--debug and --debug as a command line argument
To test the monitor, move your ugccmon.cfg or rename it, an exception will be thrown if the monitor cannot find it.
To do the test run: MONO_OPTIONS=--debug mono-service --debug ugccmonsvc.exe, the exception should be printed on screen
Note: You may have to run the stop.sh script to clean up the tmp lockfiles in order to start the monitor again.
Exceptions may be available in /var/log/messages as well as journalctl.
Masher
-----------
Please do not PM me unless asked to! We are a small company. If you have an issue or question it would be best to post it in the forums where it can help others in the future.

NEW Join our Discord!
Post Reply