Skip to content

Commit 8c7eb9c

Browse files
committed
Move warning to more relevant doc
1 parent 33cd37b commit 8c7eb9c

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

docs/core/diagnostics/eventsource-collect-and-view-traces.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,14 @@ this isn't required. Following is an example `EventListener` implementation that
272272
3/24/2022 9:23:35 AM RequestStart
273273
3/24/2022 9:23:35 AM RequestStop
274274
```
275+
276+
> [!WARNING]
277+
> Potential Deadlocks with EventSource Callbacks
278+
>
279+
> When implementing EventSources, be cautious with invoking lock-acquiring APIs within EventSource callbacks. EventSource instances are initialized early in the runtime, before some core features are fully initialized. As a result, the re-entrant behavior of EventSource callbacks may cause deadlocks if the callback attempts to acquire locks already held by the thread that triggered the callback.
280+
>
281+
> To mitigate this risk, consider the following precautions:
282+
>
283+
> - **Avoid Complex Operations**: Refrain from performing complex operations within the callback that might acquire additional locks.
284+
> - **Minimize Lock Duration**: Ensure that any locks acquired within the callback are not held for extended periods.
285+
> - **Use Non-blocking APIs**: Prefer using non-blocking APIs within the callback to avoid potential deadlocks.

docs/core/diagnostics/eventsource.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@ your own custom events.
2020
> Many technologies that integrate with EventSource use the terms 'Tracing' and 'Traces' instead of 'Logging' and 'Logs'.
2121
> The meaning is the same here.
2222
23-
> [!WARNING]
24-
> Potential Deadlocks with EventSource Callbacks
25-
>
26-
> When implementing EventSources, be cautious with invoking lock-acquiring APIs within EventSource callbacks. EventSource instances are initialized early in the runtime, before some core features are fully initialized. As a result, the re-entrant behavior of EventSource callbacks may cause deadlocks if the callback attempts to acquire locks already held by the thread that triggered the callback.
27-
>
28-
> To mitigate this risk, consider the following precautions:
29-
>
30-
> - **Avoid Complex Operations**: Refrain from performing complex operations within the callback that might acquire additional locks.
31-
> - **Minimize Lock Duration**: Ensure that any locks acquired within the callback are not held for extended periods.
32-
> - **Use Non-blocking APIs**: Prefer using non-blocking APIs within the callback to avoid potential deadlocks.
33-
3423
- [Getting started](./eventsource-getting-started.md)
3524
- [Instrumenting code to create events](./eventsource-instrumentation.md)
3625
- [Collecting and viewing event traces](./eventsource-collect-and-view-traces.md)

0 commit comments

Comments
 (0)