RDKEMW-23908: Reduce default ping count from 3 to 1 and timeout from 3s to 1s - #345
RDKEMW-23908: Reduce default ping count from 3 to 1 and timeout from 3s to 1s#345tukken-comcast wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Mitigates JSON-RPC Ping being a synchronous/blocking call by reducing its default work (fewer packets, shorter timeout), and updates API documentation/schema to reflect the new default request count.
Changes:
- Reduced
Pingdefault request count from 3 to 1 in the JSON-RPC implementation. - Reduced
Pingdefault timeout from 3s to 1s in the JSON-RPC implementation. - Updated API docs/schema to reflect the new default
countvalue.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| plugin/NetworkManagerJsonRpc.cpp | Updates JSON-RPC Ping defaults (count/timeout) to reduce blocking duration. |
| docs/NetworkManagerPlugin.md | Updates Ping parameter docs (default count), but currently omits the new default timeout. |
| definition/NetworkManager.json | Updates count definition summary default, but timeout definition remains generic despite Ping default change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| | params?.count | integer | <sup>*(optional)*</sup> The number of requests to send. Default is 1 | | ||
| | params?.timeout | integer | <sup>*(optional)*</sup> Timeout | |
| "summary": "The number of requests to send. Default is 1.", | ||
| "type": "integer", | ||
| "example": 10 |
karuna2git
left a comment
There was a problem hiding this comment.
Change the legacyNetwork.cpp also for the defaults
e191231 to
bc351d2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
docs/NetworkManagerPlugin.md:887
- The Ping parameter table updates the default
countto 1, but the PR also changes the defaulttimeoutto 1s; thetimeoutrow currently doesn’t document the new default or the unit (seconds), which can confuse API consumers.
| params?.count | integer | <sup>*(optional)*</sup> The number of requests to send. Default is 1 |
| params?.timeout | integer | <sup>*(optional)*</sup> Timeout |
…erval (0.2s->0.002s) Reason for change: Current Ping method is synchronous and blocks other method calls while ping is executing. This fix is a mitigation. A proper fix requires methods like Ping that trigger long-running operations to be asynchronous. Test Procedure: Refer ticket Risks: Low Signed-off-by: Tony_Ukken2@comcast.com
bc351d2 to
0815dab
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
plugin/NetworkManagerImplementation.cpp:458
ping/ping6interval was changed from 0.2s to 0.002s. On common iputils builds, intervals <0.2s are treated as “flood” and require elevated privileges (or special sysctls), so this can cause Ping to fail for non-privileged service users when callers passcount>1. Keeping the previous 0.2s avoids a runtime failure while still allowing the reduced default count/timeout to mitigate blocking.
snprintf(cmd, sizeof(cmd), "ping -c %d -W %d -i 0.002 '%s' 2>&1", noOfRequest, timeOutInSeconds, endpoint.c_str());
| if(0 == strcasecmp("IPv6", ipversion.c_str())) | ||
| { | ||
| snprintf(cmd, sizeof(cmd), "ping6 -c %d -W %d -i 0.2 '%s' 2>&1", noOfRequest, timeOutInSeconds, endpoint.c_str()); | ||
| snprintf(cmd, sizeof(cmd), "ping6 -c %d -W %d -i 0.002 '%s' 2>&1", noOfRequest, timeOutInSeconds, endpoint.c_str()); |
Reason for change: Current Ping method is synchronous and blocks other method calls while ping is executing. This fix is a mitigation. A proper fix requires methods like Ping that trigger long-running operations to be asynchronous.
Test Procedure: Refer ticket
Risks: Low
Signed-off-by: Tony_Ukken2@comcast.com