Causeway

From Erights

(Difference between revisions)
Jump to: navigation, search
(Menu Commands)
 
(21 intermediate revisions not shown)
Line 1: Line 1:
== Causeway: A message-oriented distributed debugger ==
== Causeway: A message-oriented distributed debugger ==
-
Causeway, an open source distributed debugger written in '''''E''''', lets you browse the causal graph of events in a distributed computation.
+
Causeway is an open source postmortem distributed debugger for examining the behavior of distributed programs built as communicating event loops. Its message-oriented approach follows the flow of messages across process and machine boundaries.
-
Causeway provides a post-mortem view, gathered from trace files written by the processes you wish to debug. (We explain below how to enable this tracing.) In the top-left pane, each tab represents the full order of events recorded by each process. This gives a "''follow the process''" view common to conventional distributed debuggers. In the Message tree pane, we see an alternative "''follow the conversation''" outline view, in which each event expands to show the events it causes.
+
== Getting Started ==
 +
The simplest way to get started is to launch Causeway from a command line shell and then open one of the examples.
-
[[Image:cw-wk-snap.png]]
+
<pre>
 +
$ cd e/src/esrc/scripts
 +
$ rune causeway.e-swt
 +
</pre>
 +
From the Welcome view select an example program from the Help menu.
-
Causeway presents several different views of the causal relations. The views are coordinated such that, selecting an item in one view causes corresponding selections in other views.
 
-
* <u>Process-order View (top-left pane)</u> This view lists events in chronological order, organized by vat. It's a tabbed view with one tab per vat. An entry in the process-order view is a 2-level subtree. The parent item represents an event; each nested item represents an eventual send that occurred during the parent event. In the screenshot, the selected item is the currently selected event in the message-order view. Synchronized selection between the process-order and message-order views is especially useful since, taken together, they convey the equivalent of spacetime diagrams.
+
[[Image:Welcome-help.png]]
-
* <u>Message-order View (top-right pane)</u> This view shows the order in which events caused other events by sending messages. This message order is reflected in the outline structure; nested events were caused by the parent event. When an event has multiple causes it is a joining event. A joining event appears directly under each of its causes and is marked with a right arrow icon. Each tree item represents a message target and is identified by a vat name and turn. The descriptive label depends on the information available in the trace record for the event and is one of the following.
+
Optionally, the sources and trace logs can be specified on the command line.
-
    * The "text" field string. This field is required for Comment records. It is optional for Sent, SentIf, and Resolved records.
+
<pre>
-
    * A single line of source code from the source file specified in the top stack entry.
+
$ rune -Dsrc=<srcRootDir> causeway.e-swt <logs>...
-
    * The source file name and function name specified in the top stack entry.
+
</pre>
 +
Java's default memory settings are sufficient for the examples but larger programs need more stack and heap space.
 +
Use the -Xss (stack) and -Xmx (heap) options to increase Java default memory sizes. Follow the amount with m for Mb or k for Kb.
 +
Notice the format does not follow the name=value convention. The J option tells rune to pass the option to Java.
-
* <u>Stack Explorer (bottom-left pane)</u> As with sequential debugging, the question is often: How did we get here  -- what chain of activations led to the current event? Causeway's stack explorer answers this question by looking back in time and presenting both eventual sends and immediate calls that led to the current event. An entry in the stack explorer is a 2-level subtree. The parent item represents an event; its nested items represent the stack trace captured for that event. In the screenshot, the top entry is the currently selected event in the message-order view. Subsequent entries are built by following the message graph back in time to sending events. An event having multiple causes has multiple paths but only the last cause is followed. Being the last in chronological order, it is expected to be the most useful for following the interesting causality.
+
<pre>
 +
$ rune -J-Xss128m -J-Xmx128m causeway.e-swt
 +
</pre>
 +
== Waterken Example (Ajax-style) ==
-
* <u>Source View (bottom-right pane)</u> This view shows the source code for the currently selected item in the stack explorer and indicates the corresponding source span.
+
This Java program ran on the Waterken server instrumented to generate Causeway's trace log format. The program is a distributed implementation of a procedure for handling new purchase orders.
 +
 
 +
Before an order is placed, certain conditions must be met: the item is in stock and available, the customer’s account is in good standing, and the delivery options are up to date. An object residing in the “buyer” process (or vat) has remote references to objects
 +
residing in the “product” and “accounts” processes. The buyer queries the remote objects with asynchronous message sends. This example uses Ajax-style continuation-passing: a request carries a callback argument to which a response should be sent.
 +
 
 +
The screenshot below shows the principal views from Causeway's postmortem display for this example.
 +
 
 +
== Causeway Viewer ==
 +
 
 +
 
 +
[[Image:viewer.png|alt=Causeway Viewer|Causeway Viewer]]
 +
 
 +
 
 +
* Search view (leftmost): This view lists bookmarks and results of search commands.
 +
 
 +
* Process-order view: This view lists events in chronological order, organized by vat. For example, clicking the "buyer" tab shows all events logged by the buyer vat. The events are ordered by turn number and within each turn, an intra-turn number.
 +
 
 +
* Message-order view: This view shows the order in which events caused other events by sending messages. Message order is reflected in the outline structure: nested events were caused by the parent event. Causeway assigns each vat a color so we can see when message flow crosses vat boundaries.
 +
 
 +
* Stack Explorer and Source view: These views are familiar from sequential debugging.
 +
 
 +
=== Menu Commands ===
 +
 
 +
'''File >> Set Source Root...''' point at the root directory of the sources.
 +
 
 +
For example, for the trace record pathname shown below,
 +
 
 +
<pre>
 +
"trace" : {
 +
  "calls" : [ {
 +
      "name" : "AsyncAnd.run",
 +
      "source" : "org/waterken/purchase_ajax/AsyncAnd.java"
 +
    } ]
 +
}
 +
</pre>
 +
 
 +
set the source root to the underlined prefix.
 +
 
 +
<u>~/Desktop/waterken/example/src/</u>org/waterken/purchase_ajax/AsyncAnd.java
 +
 
 +
''(Limitation: Cannot set multiple source roots.)''
 +
 
 +
 
 +
'''File >> Open''' select log files to open.
 +
 
 +
''(Limitation: Cannot select a folder. Must go into the folder and select the multiple files.)''
 +
 
 +
 
 +
'''File >> Export...''' translates Causeway's message graph (DAG) to the GraphViz DOT format and writes the dot file to a local disk. The dot file is a human-readable text file. It specifies a graph using the DOT language. [http://www.graphviz.org/ GraphViz] must be downloaded and installed to see the graph visualization. The graph below was generated for the Waterken example described above.
 +
 
 +
 
 +
[[Image:messageGraph.png|alt=Causeway's DAG as GraphViz graph]]
 +
 
 +
 
 +
'''Search >> Find Lost Messages''' reports sent messages that were apparently not received.
 +
 
 +
'''Tools >> Set Filter Options...''' presents all source files seen during parsing of the trace logs. Individual files can be filtered out.
 +
 
 +
 
 +
[[Image:filter-async-and.png|alt=Filter options dialog]]
 +
 
 +
 
 +
Filtering <code>AsyncAnd.java</code> hides all stack frames whose source is in the <code>AsyncAnd</code> class, resulting in simpler, more abstract message-order view and GraphViz graph (as shown below).
 +
 
 +
 
 +
[[Image:filtered-mov.png|alt=Message-order view with AsyncAnd.java filter]]
 +
 
 +
 
 +
[[Image:filtered-mg.png|alt=Message graph with AsyncAnd.java filter]]
 +
 
 +
 
 +
''(Limitation: These settings are not persistent across launches.)''
 +
 
 +
=== Context Menu Commands ===
 +
 
 +
'''Bookmark''' bookmarks the currently selected event.
 +
 
 +
 
 +
[[Image:bookmark.png|alt=Bookmark menu item]]
 +
 
 +
 
 +
'''Find Multiples''' finds the multiple causes of a joining event, e.g., finds the multiple sends to a target showing a multiples icon.
 +
 
 +
 
 +
[[Image:find-multiples.png|alt=Find multiples menu item]]
 +
 
 +
 
 +
'''Search Stacks''' finds all events that contain a stack frame for this source line, e.g., all events passing through this source code.
 +
 
 +
 
 +
[[Image:search-stacks.png|alt=Search stacks menu item]]
 +
 
 +
 
 +
''(Limitation: Matching events must match exactly on source and line position as specified in the trace logs. Not all lines in the source view can be searched and currently, there is no visual indication identifying the lines that can be searched.)''
== See Also ==
== See Also ==
-
[http://www.erights.org/elang/tools/causeway/causeway-paper.pdf Causeway draft paper]
+
[[Causeway Platform Developer]] to understand how to instrument a platform to generate Causeway trace logs.
 +
 
 +
[http://www.hpl.hp.com/techreports/2009/HPL-2009-78.html HP Labs Technical Report] presents our experience with the Waterken web server which we have instrumented to generate Causeway's language-neutral trace log format.
 +
 
 +
[http://www.youtube.com/watch?v=QeqcGa7HlBk Screencast] presents a brief demonstration of Causeway, using the example from the HP Tech Report.
 +
 
 +
[http://waterken.sourceforge.net/debug/ Debugging a Waterken application] explains how to configure the Waterken server to emit the [[wikipedia:JSON|JSON]] debugging records understood by Causeway.
-
Our current development effort is to generalize Causeway to support asynchronous message-passing programs running on event loop-based platforms in general, not just '''''E'''''. Our initial focus has been on the Waterken server.
+
[http://code.google.com/p/ambienttalk/wiki/Debugging Debugging AmbientTalk using Causeway] explains how to emit Causeway debugging records, in order to use Causeway to debug AmbientTalk applications.
-
[http://waterken.sourceforge.net/debug/ Using Causeway to debug Waterken applications]
+
[[Category:Applications]]
[[Category:Applications]]

Latest revision as of 22:50, 26 May 2010

Contents

Causeway: A message-oriented distributed debugger

Causeway is an open source postmortem distributed debugger for examining the behavior of distributed programs built as communicating event loops. Its message-oriented approach follows the flow of messages across process and machine boundaries.

Getting Started

The simplest way to get started is to launch Causeway from a command line shell and then open one of the examples.

$ cd e/src/esrc/scripts
$ rune causeway.e-swt

From the Welcome view select an example program from the Help menu.


Image:Welcome-help.png


Optionally, the sources and trace logs can be specified on the command line.

$ rune -Dsrc=<srcRootDir> causeway.e-swt <logs>...

Java's default memory settings are sufficient for the examples but larger programs need more stack and heap space. Use the -Xss (stack) and -Xmx (heap) options to increase Java default memory sizes. Follow the amount with m for Mb or k for Kb. Notice the format does not follow the name=value convention. The J option tells rune to pass the option to Java.

$ rune -J-Xss128m -J-Xmx128m causeway.e-swt 

Waterken Example (Ajax-style)

This Java program ran on the Waterken server instrumented to generate Causeway's trace log format. The program is a distributed implementation of a procedure for handling new purchase orders.

Before an order is placed, certain conditions must be met: the item is in stock and available, the customer’s account is in good standing, and the delivery options are up to date. An object residing in the “buyer” process (or vat) has remote references to objects residing in the “product” and “accounts” processes. The buyer queries the remote objects with asynchronous message sends. This example uses Ajax-style continuation-passing: a request carries a callback argument to which a response should be sent.

The screenshot below shows the principal views from Causeway's postmortem display for this example.

Causeway Viewer

Causeway Viewer


  • Search view (leftmost): This view lists bookmarks and results of search commands.
  • Process-order view: This view lists events in chronological order, organized by vat. For example, clicking the "buyer" tab shows all events logged by the buyer vat. The events are ordered by turn number and within each turn, an intra-turn number.
  • Message-order view: This view shows the order in which events caused other events by sending messages. Message order is reflected in the outline structure: nested events were caused by the parent event. Causeway assigns each vat a color so we can see when message flow crosses vat boundaries.
  • Stack Explorer and Source view: These views are familiar from sequential debugging.

Menu Commands

File >> Set Source Root... point at the root directory of the sources.

For example, for the trace record pathname shown below,

"trace" : {
  "calls" : [ {
      "name" : "AsyncAnd.run",
      "source" : "org/waterken/purchase_ajax/AsyncAnd.java"
    } ]
}

set the source root to the underlined prefix.

~/Desktop/waterken/example/src/org/waterken/purchase_ajax/AsyncAnd.java

(Limitation: Cannot set multiple source roots.)


File >> Open select log files to open.

(Limitation: Cannot select a folder. Must go into the folder and select the multiple files.)


File >> Export... translates Causeway's message graph (DAG) to the GraphViz DOT format and writes the dot file to a local disk. The dot file is a human-readable text file. It specifies a graph using the DOT language. GraphViz must be downloaded and installed to see the graph visualization. The graph below was generated for the Waterken example described above.


Causeway's DAG as GraphViz graph


Search >> Find Lost Messages reports sent messages that were apparently not received.

Tools >> Set Filter Options... presents all source files seen during parsing of the trace logs. Individual files can be filtered out.


Filter options dialog


Filtering AsyncAnd.java hides all stack frames whose source is in the AsyncAnd class, resulting in simpler, more abstract message-order view and GraphViz graph (as shown below).


Message-order view with AsyncAnd.java filter


Message graph with AsyncAnd.java filter


(Limitation: These settings are not persistent across launches.)

Context Menu Commands

Bookmark bookmarks the currently selected event.


Bookmark menu item


Find Multiples finds the multiple causes of a joining event, e.g., finds the multiple sends to a target showing a multiples icon.


Find multiples menu item


Search Stacks finds all events that contain a stack frame for this source line, e.g., all events passing through this source code.


Search stacks menu item


(Limitation: Matching events must match exactly on source and line position as specified in the trace logs. Not all lines in the source view can be searched and currently, there is no visual indication identifying the lines that can be searched.)

See Also

Causeway Platform Developer to understand how to instrument a platform to generate Causeway trace logs.

HP Labs Technical Report presents our experience with the Waterken web server which we have instrumented to generate Causeway's language-neutral trace log format.

Screencast presents a brief demonstration of Causeway, using the example from the HP Tech Report.

Debugging a Waterken application explains how to configure the Waterken server to emit the JSON debugging records understood by Causeway.

Debugging AmbientTalk using Causeway explains how to emit Causeway debugging records, in order to use Causeway to debug AmbientTalk applications.

Personal tools
more tools