Skip to content

Conversation

@dolepee
Copy link

@dolepee dolepee commented Feb 11, 2026

Problem

RFmapper updates scan state from a background thread and reads it from the run loop without synchronization. This can produce inconsistent reads and race conditions.

There are also two runtime reliability issues:

  • self.sleep(1) is called even though RFmapper has no sleep() method
  • shutdown waits with an unconditional sleep before join()

Related issue: #1771

Changes

  • add threading.Lock() (scan_lock) for shared scan state
  • guard scan_idx, scan_results, and scan_last_sent reads/writes with the lock
  • replace deprecated logging.warn with logging.warning
  • remove unused self.seen_names
  • replace self.sleep(1) with time.sleep(1.0)
  • replace stop-time sleep + join with self.thread.join(timeout=1.0)

Validation

  • python3 -m py_compile src/backgrounds/plugins/rf_mapper.py

@dolepee dolepee requested review from a team as code owners February 11, 2026 10:09
@github-actions github-actions bot added robotics Robotics code changes python Python code labels Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Python code robotics Robotics code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant