Skip to content

fix: fix logging format error and noisy backpressure warning#512

Merged
Alpaca233 merged 2 commits into
masterfrom
fix/logging-errors
Mar 14, 2026
Merged

fix: fix logging format error and noisy backpressure warning#512
Alpaca233 merged 2 commits into
masterfrom
fix/logging-errors

Conversation

@Alpaca233
Copy link
Copy Markdown
Collaborator

Summary

  • microcontroller.py: log.warning() call was passing CommandAborted exception as a positional arg without a %s placeholder, causing TypeError: not all arguments converted during string formatting on every aborted command
  • widgets.py: BackpressureMonitorWidget logged a warning on 'NoneType' object has no attribute 'get_lock' — a benign race condition when the acquisition's multiprocessing objects are cleaned up while the update timer is still firing. Downgraded to debug.

Test plan

  • Run an acquisition that triggers command timeouts — verify the warning now prints the error message instead of a --- Logging error --- traceback
  • Stop an acquisition and verify no WARNING - Backpressure monitor update failed spam in logs

🤖 Generated with Claude Code

- microcontroller.py: add %s placeholder so CommandAborted error is
  formatted into the log message instead of causing a TypeError
- widgets.py: downgrade backpressure monitor update failure from warning
  to debug — this is a benign race condition when multiprocessing objects
  are cleaned up while the timer is still firing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes two logging-related issues to reduce log noise and prevent a logging formatting crash during aborted MCU commands.

Changes:

  • Fix Microcontroller.send_command() warning formatting to safely log the stored CommandAborted error.
  • Downgrade BackpressureMonitorWidget update failure logging from warning to debug to avoid benign log spam during teardown.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
software/control/microcontroller.py Adds a %s placeholder so the warning can include the CommandAborted object without triggering logging formatting errors.
software/control/widgets.py Changes backpressure monitor update failure logging to debug and adjusts exception handling during shutdown/cleanup races.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment thread software/control/widgets.py Outdated
self.stop_monitoring()
except Exception as e:
self._log.warning(f"Backpressure monitor update failed: {e}")
except (AttributeError, Exception) as e:
Separate the benign AttributeError race (debug) from unexpected
exceptions (warning) instead of downgrading all failures to debug.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Alpaca233 Alpaca233 merged commit 6e3f731 into master Mar 14, 2026
3 checks passed
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.

2 participants