Skip to content

Commit ad3b337

Browse files
committed
fixup: context change reentrancy considerations
Signed-off-by: Todd Baert <[email protected]>
1 parent 58d3d60 commit ad3b337

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: specification.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1025,14 +1025,14 @@
10251025
{
10261026
"id": "Conditional Requirement 5.3.4.2",
10271027
"machine_id": "conditional_requirement_5_3_4_2",
1028-
"content": "If the provider's `on context changed` function terminates normally, associated `PROVIDER_CONTEXT_CHANGED` handlers MUST run.",
1028+
"content": "If the provider's `on context changed` function terminates normally, and no other invocations have yet to terminate, associated `PROVIDER_CONTEXT_CHANGED` handlers MUST run.",
10291029
"RFC 2119 keyword": "MUST",
10301030
"children": []
10311031
},
10321032
{
10331033
"id": "Conditional Requirement 5.3.4.3",
10341034
"machine_id": "conditional_requirement_5_3_4_3",
1035-
"content": "If the provider's `on context changed` function terminates abnormally, associated `PROVIDER_ERROR` handlers MUST run.",
1035+
"content": "If the provider's `on context changed` function terminates abnormally, and no other invocations have yet to terminate, associated `PROVIDER_ERROR` handlers MUST run.",
10361036
"RFC 2119 keyword": "MUST",
10371037
"children": []
10381038
}

Diff for: specification/sections/05-events.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,19 @@ see: [provider event types](../types.md#provider-events), [provider events](#51-
202202

203203
##### Conditional Requirement 5.3.4.2
204204

205-
> If the provider's `on context changed` function terminates normally, associated `PROVIDER_CONTEXT_CHANGED` handlers **MUST** run.
205+
> If the provider's `on context changed` function terminates normally, and no other invocations have yet to terminate, associated `PROVIDER_CONTEXT_CHANGED` handlers **MUST** run.
206206
207207
The implementation must run any `PROVIDER_CONTEXT_CHANGED` handlers associated with the provider after the provider has reconciled its state and returned from the `on context changed` function.
208208
The `PROVIDER_CONTEXT_CHANGED` is not emitted from the provider itself; the SDK implementation must run the `PROVIDER_CONTEXT_CHANGED` handlers if the `on context changed` function terminates normally.
209-
209+
It's possible that the `on context changed` function is invoked simultaneously or in quick succession; in this case the SDK will only run the `PROVIDER_CONTEXT_CHANGED` handlers after all reentrant invocations have terminated, and the last to terminate was successful (terminated normally).
210210
see: [provider event types](../types.md#provider-events), [provider events](#51-provider-events), [provider context reconciliation](02-providers.md#26-provider-context-reconciliation)
211211

212212
##### Conditional Requirement 5.3.4.3
213213

214-
> If the provider's `on context changed` function terminates abnormally, associated `PROVIDER_ERROR` handlers **MUST** run.
214+
> If the provider's `on context changed` function terminates abnormally, and no other invocations have yet to terminate, associated `PROVIDER_ERROR` handlers **MUST** run.
215215
216216
The `PROVIDER_ERROR` is not emitted from the provider itself; the SDK implementation must run the `PROVIDER_ERROR` handlers if the `on context changed` throws or otherwise signals an error.
217+
It's possible that the `on context changed` function is invoked simultaneously or in quick succession; in this case the SDK will only run the `PROVIDER_ERROR` handlers after all reentrant invocations have terminated, and the last to terminate was unsuccessful (terminated abnormally).
217218

218219
see: [provider event types](../types.md#provider-events), [provider events](#51-provider-events), [provider context reconciliation](02-providers.md#26-provider-context-reconciliation)
219220

0 commit comments

Comments
 (0)