Skip to content

pytest-sync: drop redundant per-iteration hardware_reset (RSDSO-21449) - #14990

Merged
Nir-Az merged 1 commit into
realsenseai:developmentfrom
Nir-Az:pytest-sync-drop-loop-reset
Apr 30, 2026
Merged

Nir-Az merged 1 commit into
realsenseai:developmentfrom
Nir-Az:pytest-sync-drop-loop-reset

Conversation

@Nir-Az

@Nir-Az Nir-Az commented Apr 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

unit-tests/live/metadata/pytest-sync.py::test_synchronized_frames segfaulted in nightly LRS_linux_compile_lib_ci #11175, killing the whole pytest session. The Python main thread was sleeping in time.sleep(5) (line 161) immediately after device.hardware_reset() (line 160); the actual fault is in a librealsense backend thread.

The pytest hub-recycle in module_device_setup (unit-tests/conftest.py:435-466) had just power-cycled the port and re-enumerated the D455 milliseconds earlier — calling hardware_reset() on a freshly enumerated USB device triggers a race in the SDK backend.

Changes

  • Drop the per-iteration device.hardware_reset() from the loop in test_synchronized_frames — it was inherited verbatim from legacy test-sync.py, which predated the hub-recycle infrastructure. With pytest's --hub-reset, iter 0 already gets a freshly recycled device, and pipeline.start/stop isolates per-config state for iters 1-5.
  • Add time.sleep(1) before the loop to let the device settle after the hub recycle (matches the convention in pytest-stress.py:75 and pytest-sanity.py:48, both of which pass).
  • Add time.sleep(2) between iterations to let hardware settle after pipeline.stop() before the next configuration starts.
  • Kept the existing time.sleep(5) after pipeline.start() in run_test() unchanged.

Reference

  • Jira: RSDSO-21449 — SDK-side race between udev device-removed callback and in-flight USB transfer; tracked separately. This PR is the test-side mitigation; the SDK fix is a separate workstream.

Test plan

  • Wait for libci CI to run; confirm pytest-sync.py no longer segfaults under --context nightly --hub-reset.
  • Confirm the test still exercises all six (resolution, fps) configurations.

Nightly build passing - https://rsjenkins.realsenseai.com/job/LRS_libci_pipeline/15315/

Copilot AI review requested due to automatic review settings April 30, 2026 07:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR mitigates a reported nightly segfault in the pytest-sync live metadata test by removing a redundant per-iteration hardware_reset() that can race with the hub-recycle infrastructure, and by adding small stabilization delays around pipeline reconfiguration.

Changes:

  • Remove device.hardware_reset() and device re-enumeration from each configuration iteration in test_synchronized_frames.
  • Add an initial time.sleep(1) after fixture setup to allow post hub-recycle settling before the first pipeline.start().
  • Add time.sleep(2) between configurations to allow settling after pipeline.stop().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Nir-Az
Nir-Az requested a review from AviaAv April 30, 2026 08:33

@AviaAv AviaAv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Nir-Az
Nir-Az merged commit c506d54 into realsenseai:development Apr 30, 2026
34 checks passed
@Nir-Az
Nir-Az deleted the pytest-sync-drop-loop-reset branch April 30, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants