Tools to debug Spark

Here you can find tips to debug and understand Spark behavior.

(Many thanks to Francisco for these wonderful docs!)

Error Logs

Error logs can be opened from Help > View Logs

Generally, they are located in:

  • User Home Directory for example: c:\Documents and Settings%USER_NAME%\Spark\logs
    and

  • Installation Directory for example: c:\Program Files\Spark\logs\

Packets Sent

Spark is based in the XMPP protocol and every packet that sends and

receives from the server can be seen in the Smack Debug Window.

To open the debug window you should press F-12 or Help -> Show Traffic Window

!smackDebugWindow.jpg!

Spark in Debug Mode

To run Spark in Debug Mode you should

  1. Download the following file:

  2. Windows: http://svn.jivesoftware.org/svn/repos/spark/trunk/src/resources/startup.bat
    or

  3. Linux: http://svn.jivesoftware.org/svn/repos/spark/trunk/src/resources/startup.sh

  4. Place in to %Spark Installation Path%/bin, for example: c:\Program Files\Spark\bin\

  5. Execute Spark from the command line: startup -debug

Now you are running spark with a transcript window with the Spark debug information.

In Windows, to get that window in a correct dimension go to the windows menu -> Properties -> Design -> and set:

  • Buffer width: 120

  • Buffer height: 8000

  • Screen width: 120

  • Screen height: 30

Notice that you cannot run more than one Spark with this script unless you change address=8000 to address=8001 (for example).

!sparkConsole.jpg!

Debug from source code

To be able to debug Spark or Smack adding breakpoints to the java source code, you need:

  1. Run Spark in debug mode

  2. Spark client and Java source code synchronized, i.e. the same version.

  3. Run
    a Remote Debugger with IntelliJ IDEA. Go to Run -> Edit
    Configurations -> Add New Configuration -> Remote -> Then fill
    in Host: the host where the spark client is running and Port: 8000.

  4. Add the necessary breakpoints and when Spark executes this code the IntelliJ debugger will be activated.

!http://www.igniterealtime.org/community/servlet/JiveServlet/downloadImage/1051/s parkRemoteDebug.jpg!

Monitoring Spark

Using jconsole you can dynamically connect to the console and see what the JVM is doing.

The jconsole executable is in JDK_HOME/bin, where JDK_HOME is the directory where the JDK is installed.

Run jconsole then select org.jivesoftware.launcher.Startup and press Connect.

!http://www.igniterealtime.org/community/servlet/JiveServlet/downloadImage/1050/s parkDebugJConsole.jpg!

Debugging Spark

Now we have everything ready to catch a bug.

Once a bug is detected the objective is to get the detailed procedure

to reproduce the bug. In this task we will need to reproduce many times

the bug until the procedure is finished and add the relevant

information extracted from the installed tools.

Examples of Spark features

(soon some debugging examples)

I’m noticing under OS/X I don’t see the “Show Traffic Window” showing up any more. Is there any setting I need to change to enable this?

You have to enable it via advanced options upon startup now. Honestly I’m not sure why that change was made. =)

Ahh cheers - I saw some Jira tickets talking about removing it due to it taking a lot of memory after awhile, so starting it explicitly does make sense in a way.