-
Notifications
You must be signed in to change notification settings - Fork 26
CW_27 export #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Y-Vaishnavi
wants to merge
26
commits into
eclipse-score:main
Choose a base branch
from
Y-Vaishnavi:5A6A3ABB4B74F4375B4D7C51733A2996
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
CW_27 export #186
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1d7d2e8
mw::log: Add tracking ticket to missing transitive dependencies
bbc6252
improve design around IsOutputEnabled method
famayman 5c9399f
fix review comments
famayman 1dd8b76
fix review comments
famayman ec1ccc3
Sync score changes to spp
Y-Vaishnavi e1b075f
Adds destailed design for datarouter session (acquire_response)
rmaddikery f0c6e37
mw/log: Enables IPC via message_passing notify support
rmaddikery 74b0e0b
pas/logging: Send acquire via Notify
rmaddikery 25f44b0
mw/log: Handle acquire via NotifyCallback
rmaddikery 2919e36
pas/logging: Check ongoing acquire notifies
rmaddikery 2f99535
pas/logging: Add acquire watchdog teardown
rmaddikery db507e2
pas/logging: Drop unused client factory
rmaddikery d216589
pas/logging: Close early-disconnect connect race
rmaddikery 76d1c56
logging: Use optional acquire watchdog deadline
rmaddikery 523ed11
pas/logging: Verify watchdog miss reset
rmaddikery 308a6ef
pas/logging: test stale connection
rmaddikery d3e8268
Fix client teardown after datarouter disconnect
rmaddikery ee1b016
pas/logging: Fix watchdog config formatting
rmaddikery 8f2e102
Removes stale receive in data_router_message_client
rmaddikery 487b8ba
Handle ENOBUFS for Notify
rmaddikery 05a6727
Refactor NotifyAcquireRequest
rmaddikery 8da62fb
fix unit tests
famayman c70d8f3
Normalize copyright headers in logging unit tests
Y-Vaishnavi 182fb5e
pas/logging: sync remaining gcc14 test fix from score logging PR #172
Y-Vaishnavi ec85662
pas/logging: update puml diagrams
Y-Vaishnavi 04e9015
pas/logging: export puml diagrams via copybara
Y-Vaishnavi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
score/datarouter/doc/design/uml/activity_watchdog_session_lifecycle.puml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| @startuml activity_watchdog_lifecycle | ||
|
|
||
| title Per-Session Acquire Watchdog Lifecycle | ||
|
|
||
| start | ||
|
|
||
| :mp_worker tick fires; | ||
|
|
||
| if (Session has acquire_in_flight?) then (yes) | ||
| if (now() > acquire_deadline?) then (yes) | ||
| :Clear acquire_in_flight; | ||
| :Increment acquire_miss_count; | ||
| if (acquire_miss_count >= max_misses?) then (yes) | ||
| :Tear down session; | ||
| stop | ||
| else (no) | ||
| :Allow next tick to\nretry acquire; | ||
| endif | ||
| else (no) | ||
| :Wait for response\nor deadline expiry; | ||
| endif | ||
| else (no) | ||
| :connection.Notify(kAcquireRequest); | ||
| :Set acquire_in_flight = true; | ||
| :Set acquire_deadline =\nnow() + watchdog_config.deadline; | ||
| endif | ||
|
|
||
| :Wait for next tick; | ||
|
|
||
| if (kAcquireResponse received?) then (yes) | ||
| :Clear acquire_in_flight; | ||
| :Reset acquire_deadline; | ||
| :Reset acquire_miss_count = 0; | ||
| :Process acquired buffer; | ||
| else (no) | ||
| :Continue waiting; | ||
| endif | ||
|
|
||
| stop | ||
|
|
||
| @enduml |
171 changes: 171 additions & 0 deletions
171
score/datarouter/doc/design/uml/client_session_interaction_sequence.puml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| @startuml sequence_notify_acquire_request | ||
|
|
||
| title IServerConnection::Notify() + Watchdog\n(Non-blocking MsgDeliverEvent) | ||
|
|
||
| skinparam sequenceMessageAlign center | ||
| skinparam responseMessageBelowArrow true | ||
|
|
||
| box "Client A (healthy)" #LightBlue | ||
| participant "User Threads\n(Client A)" as UTA | ||
| participant "SharedMemoryWriter\n(Client A)" as SHMA | ||
| participant "QnxDispatchEngine\n(Client A)" as AE | ||
| end box | ||
|
|
||
| box "Client X (unhealthy)" #PeachPuff | ||
| participant "QnxDispatchEngine\n(Client X)" as XE | ||
| end box | ||
|
|
||
| box "Datarouter Process" #LightGreen | ||
| participant "QnxDispatchEngine\n(server engine)" as SE | ||
| participant "mp_worker thread" as MW | ||
| participant "Watchdog Timer" as WD | ||
| participant "DLT output" as DLT | ||
| end box | ||
|
|
||
| note over SE | ||
| Datarouter sends kAcquireRequest | ||
| via **IServerConnection::Notify()** on the already- | ||
| established server connection for each client. | ||
|
|
||
| Notify() calls **MsgDeliverEvent()** which delivers | ||
| a QNX pulse to the client — **fire-and-forget, | ||
| returns immediately, never blocks**. | ||
| end note | ||
|
|
||
| == Initialization == | ||
|
|
||
| UTA -> AE : DatarouterMessageClientImpl::Run() | ||
| AE -> SE : kConnect (appid, uid, pid)\n[Send() — one-time, acceptable] | ||
|
|
||
| SE -> SE : connect_callback()\nStore IServerConnection\nfor this client | ||
|
|
||
| note over SE | ||
| Datarouter now holds the | ||
| IServerConnection reference | ||
| for each connected client. | ||
| This is the handle for Notify(). | ||
| end note | ||
|
|
||
| MW -> MW : Create session + start watchdog\n(per-client deadline timer) | ||
|
|
||
| == Steady-State: Acquire via Notify == | ||
|
|
||
| MW -> MW : RunWorkerThread()\ntick() fires for Client A | ||
|
|
||
| MW -> SE : **connection_A.Notify(kAcquireRequest)** | ||
|
|
||
| SE -> SE : QnxDispatchServer::\nServerConnection::Notify() | ||
|
|
||
| note over SE #LightGreen | ||
| Internally: | ||
| 1. Copy message to notify_pool_ slot | ||
| 2. Push to send_queue_ | ||
| 3. **MsgDeliverEvent(rcvid, &pulse)** - Returns immediately and never blocks. | ||
| end note | ||
|
|
||
| SE -->> AE : QNX pulse delivered\n(async, non-blocking) | ||
|
|
||
| AE -> AE : dispatch_block() receives pulse\n→ readv() → ProcessInput(NOTIFY)\n→ notify_callback_() | ||
|
|
||
| note over AE | ||
| Client's NotifyCallback | ||
| (new, registered at Start()): | ||
| validates message, calls | ||
| ReadAcquire(), sends response. | ||
| end note | ||
|
|
||
| AE -> SHMA : ReadAcquire() | ||
| SHMA -> SHMA : alternating_reader_.Switch()\nBuffer A → B | ||
|
|
||
| AE -> SE : **Send(kAcquireResponse + result)**\n[Client → Datarouter: Send is safe,\nDatarouter is always ready to receive] | ||
|
|
||
| SE -> MW : MessageCallback()\n→ OnAcquireResponse() | ||
| MW -> MW : session.on_acquire_response(acq) | ||
|
|
||
| MW -> SHMA : Wait for writers to release\nRead acquired Buffer A | ||
| MW -> DLT : Forward log records ✓ | ||
|
|
||
| MW -> WD : Reset watchdog timer for Client A | ||
|
|
||
| == Client X is unhealthy == | ||
|
|
||
| note over XE #PeachPuff | ||
| X's engine thread is unhealthy (probable causes): | ||
| • crash leading to suspended thread | ||
| • Priority inversion | ||
| • CPU starvation | ||
| end note | ||
|
|
||
| MW -> MW : tick() fires for Client X | ||
| MW -> SE : **connection_XYZ.Notify(kAcquireRequest)** | ||
|
|
||
| SE -> SE : MsgDeliverEvent()\n→ **returns immediately!** | ||
|
|
||
| note over SE #LightGreen | ||
| Pulse is queued in X's | ||
| QNX receive channel. | ||
| Datarouter does NOT block. | ||
| Server engine thread is free. | ||
| end note | ||
|
|
||
| note over XE #PeachPuff | ||
| X never processes the pulse. | ||
| No response comes back. | ||
| **But Datarouter is NOT blocked.** | ||
| end note | ||
|
|
||
| == Meanwhile: Client A continues unaffected == | ||
|
|
||
| MW -> MW : tick() fires for Client A | ||
| MW -> SE : **connection_A.Notify(kAcquireRequest)** | ||
| SE -->> AE : pulse delivered | ||
| AE -> SHMA : ReadAcquire() | ||
| AE -> SE : Send(kAcquireResponse) | ||
| MW -> DLT : Forward Client A's logs | ||
|
|
||
| note over DLT #LightGreen | ||
| **Client A is unaffected** | ||
| by X being unhealthy. | ||
| end note | ||
|
|
||
| == Watchdog: Detect unresponsive X == | ||
|
|
||
| WD -> WD : Client X deadline expired\n(no kAcquireResponse within T seconds) | ||
|
|
||
| WD -> MW : Notify: X unresponsive | ||
|
|
||
| MW -> MW : Increment X miss counter | ||
|
|
||
| alt X misses < max_allowed_misses | ||
| MW -> MW : Retry: enqueue next tick\n(X gets another chance) | ||
| MW -> SE : connection_XYZ.Notify(kAcquireRequest)\n[still non-blocking, still safe] | ||
| else X misses >= max_allowed_misses | ||
| MW -> MW : **Tear down X session** | ||
|
|
||
| note over MW #LightYellow | ||
| Session teardown: | ||
| 1. Mark session for delete | ||
| 2. Attempt post-mortem read | ||
| of X's current buffer | ||
| (best-effort, no IPC needed) | ||
| 3. Remove from pid_session_map_ | ||
| 4. Log diagnostic event | ||
| end note | ||
|
|
||
| MW -> SHMA : Post-mortem: read whatever\nis in X's last buffer\n(shmem is still mapped) | ||
| MW -> DLT : Forward recovered records\n(if any valid ones found) | ||
|
|
||
| MW -> MW : Erase session from map\nClose server connection | ||
| destroy XE | ||
| end | ||
|
|
||
| == Subsequent X reconnect (if X recovers) == | ||
|
|
||
| note over MW | ||
| If X was merely slow (not dead), | ||
| it may reconnect later with a new | ||
| kConnect. Datarouter creates a | ||
| fresh session — clean slate. | ||
| end note | ||
|
|
||
| @enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activity_watchdog_session_lifecycle.puml and the other .puml files are missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated changes in latest commit, Thanks!