Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors Service Manager (SM) message handling to better separate stream reading from message processing (CM-side), consolidates error logging for incoming messages (SM-side), and tweaks a default CM timeout.
Changes:
SMClient: consolidate per-message error handling into a singleError err+ shared log path.SMHandler: split stream reading and message processing into two threads with a mutex/condvar-protected queue.config: reducecDefaultUnitStatusSendTimeoutfrom30sto10s.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/sm/smclient/smclient.cpp |
Simplifies incoming message dispatch by centralizing error logging. |
src/cm/smcontroller/smhandler.hpp |
Introduces queue/condvar + two-thread model fields for outgoing message handling. |
src/cm/smcontroller/smhandler.cpp |
Implements read thread that enqueues messages and a processing thread that drains the queue. |
src/cm/config/config.cpp |
Lowers default unit status send timeout to 10 seconds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When sync responses and incoming messages are processed in one thread, it may lead to dead lock when some module hold its mutex while sending sync message and at this time it receives incoming message that also processed under same mutex. This is usual pattern in our implementation. Add queue for incoming messages and process it in separate thread. It allows to avoid above dead lock. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Disk quota is set in blocks of 1024 bytes. Update SetUserQuota and runtime container monitoring accordingly. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Static analysis doesn't require build and could be performed first to fail as soon as any issue detected. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
| } | ||
|
|
||
| if (!err.IsNone()) { | ||
| LOG_ERR() << "Failed to process incoming message" << Log::Field(AOS_ERROR_WRAP(err)); |
There was a problem hiding this comment.
I would better put AOS_ERROR_WRAP closer to the code causing the error, eg.
err = AOS_ERROR_WRAP(ProcessUpdateNetworks(incomingMsg.update_networks()));
| err = ProcessInstantMonitoring(outgoingMsg.instant_monitoring()); | ||
| } else if (outgoingMsg.has_alert()) { | ||
| err = ProcessAlert(outgoingMsg.alert()); | ||
| } else if (auto processErr = mSyncMessageSender.ProcessResponse(outgoingMsg); processErr.HasValue()) { |
There was a problem hiding this comment.
not needed anymore
mykola-kobets-epam
left a comment
There was a problem hiding this comment.
Reviewed-by: Mykola Kobets <mykola_kobets@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
No description provided.