Skip to content

Commit 32a30fd

Browse files
committed
Add explanation for STP violation.
1 parent fbab2d0 commit 32a30fd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

03-timestamps.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,12 @@ Fed 3 (gm2_main): ERROR: STP violation occurred in a trigger to reaction 1, and
112112
**** Invoking reaction at the wrong tag!
113113
```
114114

115+
A **safe-to-process (STP) violation** above means a message arrived after the receiving federate had already advanced past that message's logical tag.
116+
In other words, the message is **tardy**, so LF needs a [**tardy handler**](https://www.lf-lang.org/docs/writing-reactors/distributed-execution/#tardy-message-handling) to decide how to handle it.
117+
115118
To intentionally trigger this error in [`src/Step3_Timestamps.lf`](src/Step3_Timestamps.lf):
116119

117-
1. Temporarily remove the `tardy {= ... =}` block attached to the `GridManager` reaction.
120+
1. Temporarily remove the `tardy {= ... =}` block (tardy handler) attached to the `GridManager` reaction.
118121
2. Make both `GridManager` `@maxwait` values very small, for example `@maxwait(1 us)` or `@maxwait(0 ms)`.
119122
3. Compile and run:
120123

@@ -125,7 +128,7 @@ To intentionally trigger this error in [`src/Step3_Timestamps.lf`](src/Step3_Tim
125128

126129
With a very small `maxwait`, a grid manager may advance logical time before an earlier remote message arrives. Without a tardy handler, the runtime reports the STP violation. After observing the error, restore the `tardy` block and return `maxwait` to `100 ms`.
127130

128-
Tardy events may be handled with a **tardy handler**.
131+
Tardy events may be handled with this **tardy handler**.
129132
For example, we can add the following to the `GridManager` reaction:
130133

131134
```lf
@@ -144,7 +147,7 @@ For example, we can add the following to the `GridManager` reaction:
144147
```
145148

146149
This handler will be invoked _instead of_ the normal reaction when a tardy message arrives.
147-
This example shows how to extract the **intended tag**, which is a timestamp, microstep pair.
150+
This example shows how to extract the [**intended tag**](https://www.lf-lang.org/docs/writing-reactors/distributed-execution/#tardy-message-handling), which is a **(timestamp, microstep)** pair.
148151
For this grid application, merely printing a warning like this is probably not the right thing to do.
149152
What could you do better?
150153

0 commit comments

Comments
 (0)