fix(hesai_hw_monitor): fix 2s drops issue - again #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Type
Related Links
Description
This PR fixes the OT128's 2s UDP packet drop issue (again, this time for node containers).
The culprit was a race condition between the HW monitor's
OnHesaiStatusTimer()
andOnHesaiLidarMonitorTimer()
callbacks, which both access the non-thread-safe HW interface.(Thread-safety will probably be fixed by #131 as the
SendReceive()
function should be thread-safe there, as a side-effect of the other fixes made.)Due to the race condition, the callbacks got into a deadlock, causing all TCP communication from HW monitor to stop. HW monitor is the only source of constant TCP traffic to the sensor (once per
diag_span
, default 1s) and is thought to refresh the sensor's ARP cache. When the monitor stops, after 1 minute the sensor sends 2 duplicate ARP requests (which are presumably a bug on the sensor side), causing the sensor to stop sending UDP packets for 2s.The fix in this PR is to merge the two above-mentioned callbacks into a unified one:
This gets rid of the sensor's duplicate ARP requests and 2s drops once per minute.
Review Procedure
Run Nebula with OT128 once with, once without this PR (using
hesai_launch_component.launch.xml
) and confirm inWireshark -> Statistics -> I/O Graphs
that once per minute there is a 2s drop without this PR, and no such drop with this PR.Remarks
Pre-Review Checklist for the PR Author
PR Author should check the checkboxes below when creating the PR.
Checklist for the PR Reviewer
Reviewers should check the checkboxes below before approval.
Post-Review Checklist for the PR Author
PR Author should check the checkboxes below before merging.
CI Checks