2.2.3 (p. 96) The DataReader requests that liveliness of
the writers is maintained by the requested
means and loss of liveliness is detected with
delay not to exceed the lease_duration.
The DataWriter commits to signalling its
liveliness using the stated means at
intervals not to exceed the lease_duration.
Since both the DataReader and DataWriter have a lease duration, the reference to lease_duration is ambiguous.
2.2.3.11 (p. 107) Changes in LIVELINESS must be detected by the Service with a time-granularity greater or equal to the lease_duration. This
ensures that the value of the LivelinessChangedStatus is updated at least once during each lease_duration and the related
Listeners and WaitSets are notified within a lease_duration from the time the LIVELINESS changed.
Same problem, the reference to lease_duration could refer to the writer or the reader.
Other sections not mentioning the lease_duration may have similar problems.
The language around on_liveliness_changed implies that changes (listener, wait set) must be communicated at least once for every lease_duration of the DataReader.
The spec should clarify three things:
1. How often does the DataReader evaluate the liveliness of a DataWriter? Is this at a period of at most the DataReader's lease_duration or a period of at most the DataWriter's lease_duration?
2. When the DataReader evaluates the liveliness of a DataWriter, which lease_duration should it use, the lease_duration of the DataReader or the lease_duration of the DataWriter?
3. Are the rules for evaluating liveliness for the purpose of ownership the same as for listeners and waitsets? This question is particularly vexing because it can lead to inconsistency where ownership should be eventually consistent.
To illustrate the problem, consider the following a system using exclusive ownership.
- Writer 1 has a lease_duration of 1 second but only writes/asserts every 4 seconds. Ownership strength of 1.
- Writer 2 has a lease_duration of 1 second but only writes/asserts every 4 seconds. Ownership strength of 2.
- Reader 1 has a lease_duration of 2 seconds.
- Reader 2 has a lease_duration of 4 seconds.
Let events happen according to this sequence:
Time |
Writer 1 |
Writer 2 |
Reader 1 |
Reader 2 |
1. |
assert |
|
|
|
2. |
|
|
eval |
|
3. |
|
assert |
|
|
4. |
|
|
eval |
eval |
5. |
assert |
|
|
|
6. |
|
|
eval |
|
7. |
|
assert |
|
|
8. |
|
|
eval |
eval |
9. |
assert |
|
|
|
10. |
|
|
eval |
|
If we assume that the readers evaluate liveliness at a period of their own lease_duration using their own lease_duration, then Reader 2 will always see Writer 2 as the owner while Reader 1 will toggle ownership between the writers. Thus, there is no eventual consistency of exclusive ownership.
If we assume that the readers evaluate liveliness at a period of their own lease_duration using the lease_duration of the writer, then both readers will consistently toggle and never see a live writer.
If we assume that the readers evaluate liveliness independently for each writer at the lease_duration of the writer, then the readers will see ownership toggling but periods where writers are alive.
Ideally, liveliness would be objective and not subjective. That is, liveliness should be based on the behavior of the writer interpretted by its lease_duration. Different readers may observe different things leading to temporary inconsistency, but eventual consistency would be guaranteed.
If the spec choose a subjective approach, then language should be added that warns the reader of the problem and the consequences like ownership not working as expected.