You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 03-timestamps.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,9 +112,12 @@ Fed 3 (gm2_main): ERROR: STP violation occurred in a trigger to reaction 1, and
112
112
**** Invoking reaction at the wrong tag!
113
113
```
114
114
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
+
115
118
To intentionally trigger this error in [`src/Step3_Timestamps.lf`](src/Step3_Timestamps.lf):
116
119
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.
118
121
2. Make both `GridManager``@maxwait` values very small, for example `@maxwait(1 us)` or `@maxwait(0 ms)`.
119
122
3. Compile and run:
120
123
@@ -125,7 +128,7 @@ To intentionally trigger this error in [`src/Step3_Timestamps.lf`](src/Step3_Tim
125
128
126
129
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`.
127
130
128
-
Tardy events may be handled with a**tardy handler**.
131
+
Tardy events may be handled with this**tardy handler**.
129
132
For example, we can add the following to the `GridManager` reaction:
130
133
131
134
```lf
@@ -144,7 +147,7 @@ For example, we can add the following to the `GridManager` reaction:
144
147
```
145
148
146
149
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.
148
151
For this grid application, merely printing a warning like this is probably not the right thing to do.
0 commit comments