Repository navigation
RDKEMW-26210: Workstream A implementation of Coarselock proposal - #649
trupthi1403 wants to merge 2 commits into
Conversation
…arseLock Summary: reduce IPC lock contention by making socket state atomic, splitting pending-call locking, moving send paths out of global locks, and adding concurrent no-reply coverage Type: Fix Test Plan: UT/CT, Fullstack Jira: RDKEMW-26210
|
Pull request title must follow the pattern: Pull request description must follow the Commit message format for RDK-E:
< JIRA TICKET >: < one line summary of change less than 65 characters > |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved socket-lifetime, receive-buffer, and callback-completion races can cause misdirected traffic, data corruption, and use-after-free.
6 open issues
Concurrent process calls race on shared channel buffers · New Socket lifetime is unprotected during I/O and callbacks · New Pending call may be completed twice after removal · New Socket descriptor can be reused before send completes · New Debug logging accesses request after completion · New Test exits while callbacks still use synchronization state · New
What changed in this PR
Implements Workstream A to reduce IPC lock contention in client channels and server connections.
Changes:
- Makes socket state atomic and separates pending-call locking.
- Moves receive buffers to individual channels and narrows server lock scopes.
- Adds concurrent no-reply request coverage.
| File | Description |
|---|---|
| tests/unittests/ipc/IpcTest.cpp | Adds multithreaded no-reply request test. |
| ipc/server/source/IpcServerImpl.h | Makes client socket descriptors atomic. |
| ipc/server/source/IpcServerImpl.cpp | Updates socket lifecycle handling and send locking. |
| ipc/client/source/IpcChannelImpl.h | Separates pending-call locking and adds per-channel buffers. |
| ipc/client/source/IpcChannelImpl.cpp | Refactors socket access, receiving, and pending-call registration. |
Review effort: Balanced
|
Coverage statistics of your commit: |
There was a problem hiding this comment.
🟡 Changes recommended
Pending calls can complete before transmission, and reentrant timeout callbacks can deadlock.
3 open issues
6 resolved since last review
Socket descriptor can be reused before send completes Pending call may be completed twice after removal Socket lifetime is unprotected during I/O and callbacks Concurrent process calls race on shared channel buffers Test exits while callbacks still use synchronization state Debug logging accesses request after completion
Review effort: Balanced
|
Coverage statistics of your commit: |
3cf4445 to
71a9147
Compare
|
Coverage statistics of your commit: |
71a9147 to
b28af94
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Scheduling-dependent test failures, added logging overhead, and missing concurrent reply-path coverage remain unresolved.
5 open issues
Timeout callback can deadlock on the processing mutex Avoid unconditional request formatting when debug logging is disabled · New Add concurrent-call coverage for registration, failures, and timeouts · New Lock remains held during debug formatting and logging · New Prevent unpaced requests from losing packets under socket backpressure · New
1 resolved since last review
Review effort: Balanced
| // copy in the actual message data | ||
| std::string reqString = request->SerializeAsString(); | ||
| call->set_request_message(std::move(reqString)); | ||
| const std::string kRequestDebugString = request->ShortDebugString(); |
| MethodCall pendingCall = methodCall; | ||
| pendingCall.timeoutDeadline = std::chrono::steady_clock::time_point::max(); | ||
|
|
||
| if (m_sock < 0) | ||
| { | ||
| errorMessage = "Not connected"; | ||
| } | ||
| else if (sendmsg(m_sock, header, MSG_NOSIGNAL) != static_cast<ssize_t>(kRequiredDataLen)) | ||
| std::lock_guard<std::mutex> locker(m_lock); | ||
| m_methodCalls.emplace(kSerialId, pendingCall); |
| for (int i = 0; i < kRequestsPerThread; ++i) | ||
| { | ||
| if (!m_clientStub->sendSingleVarRequestWithNoReply(m_int)) | ||
| { | ||
| allRequestsSucceeded.store(false, std::memory_order_relaxed); |
|
Coverage statistics of your commit: |
b28af94 to
fcea6da
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The revised synchronization and pending-call lifecycle require human validation of concurrent reply and disconnect behavior.
5 open issues
Timeout callback can deadlock on the processing mutex Prevent unpaced requests from losing packets under socket backpressure Lock remains held during debug formatting and logging Add concurrent-call coverage for registration, failures, and timeouts Avoid unconditional request formatting when debug logging is disabled
Review effort: Balanced
|
Coverage statistics of your commit: |
fcea6da to
2de867e
Compare
2de867e to
ea109cd
Compare
|
Coverage statistics of your commit: |
1 similar comment
|
Coverage statistics of your commit: |


RDKEMW-26210: Workstream A implementation of Coarselock proposal
Reason for change: reduce IPC lock contention by making socket state atomic, splitting pending-call locking
Test Procedure: UT/CT, Fullstack