Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Ready to approve
The changes are focused, are covered by updated unit tests, and align with the goal of preventing unbounded output retention.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR addresses potential unbounded memory growth in the rshell_server by ensuring stored command outputs don’t accumulate indefinitely and are removed after retrieval or after a TTL expires.
Changes:
- Added timestamp tracking for stored command outputs and a TTL-based cleanup routine to evict stale entries.
- Updated
get_output()to remove outputs (and timestamps) once consumed to prevent indefinite retention. - Extended unit tests to cover timestamp bookkeeping, cleanup behavior, and queue removal on client disconnect.
File summaries
| File | Description |
|---|---|
mfd_connect/rshell_server.py |
Adds output timestamp tracking + stale-output cleanup, and removes outputs after retrieval/disconnect. |
tests/unit/test_mfd_connect/test_rshell_server.py |
Updates tests to validate output eviction, timestamp handling, and stale cleanup behavior. |
Review details
Comments suppressed due to low confidence (1)
mfd_connect/rshell_server.py:65
- For consistency with monotonic TTL comparisons, store timestamps using time.monotonic() (not time.time()).
def _store_output(command_id: str, output: str, rc: int) -> None:
"""Persist command output together with its insertion timestamp."""
_cleanup_stale_outputs()
output_queue[command_id] = output_object(output=output, rc=rc)
output_queue_timestamps[command_id] = time.time()
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
🟡 Not ready to approve
The TTL cleanup uses a monotonic clock while stored timestamps use wall-clock time, which prevents stale entries from ever expiring in production.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
mfd_connect/rshell_server/rshell_server.py:64
- _cleanup_stale_outputs() measures
current_timewithtime.monotonic(), but_store_output()recordscreated_atwithtime.time(). Mixing monotonic time with wall-clock time meanscurrent_time - created_atwill typically be a large negative number, so stale entries will never be collected in production (defeating the memory-growth fix). Use the same clock source for both (prefertime.monotonic()for TTL calculations).
def _store_output(command_id: str, output: str, rc: int) -> None:
"""Persist command output together with its insertion timestamp."""
_cleanup_stale_outputs()
output_queue[command_id] = output_object(output=output, rc=rc)
output_queue_timestamps[command_id] = time.time()
adrianlasota
left a comment
There was a problem hiding this comment.
fix the commits, there is merge commit
3cb3495 to
f698b74
Compare
7ecfc0d to
8d482a3
Compare
88a99a5 to
52ee998
Compare
|
Added a follow-up commit to this PR:
Validation: 102 RShell tests and The independent unread-output-pipe fix is in #53. Its branch includes both changes for combined testing; its staging base mirrors this PR. No merge is required to test the combined branch. |
| time.sleep = _sleep | ||
|
|
||
|
|
||
| def _close(connection): # noqa: ANN001, ANN202 |
There was a problem hiding this comment.
Please, add input params to docstring as for it's for other, already existing methods
There was a problem hiding this comment.
Addressed in 76c5d98: added :param connection: to _close() using the existing docstring convention, including the supported None value.
|
@abaczek Please capitalize the commit title. |
2bd06a7 to
76c5d98
Compare
|
Addressed the commit-title comment: the updated commit is Fix: bound rshell result storage and clean up completed commands (76c5d98). The four open review threads are addressed in the same commit, with focused regression tests. Validation: 119 RShell tests and |
…ient The EFI client executes commands with a blocking os.system() call, so a tool that hangs on the DUT stops its polling loop for good and every later command times out. Track when each client last polled and which command it picked up, and return that diagnosis in the X-RShell-Timeout-Reason header. Signed-off-by: Ziomek, Kamil <kamil.ziomek@intel.com>
Signed-off-by: Arkadiusz Baczek <86051266+abaczek@users.noreply.github.com>
76c5d98 to
c3232d0
Compare


No description provided.