Skip to content

Fix: Reuse PairedTransmitter outside loop to prevent repeated ZMQ socket creation (#268)#294

Merged
pradeeban merged 1 commit intoControlCore-Project:devfrom
GaneshPatil7517:fix/zmq-transmitter-lifecycle
Feb 13, 2026
Merged

Fix: Reuse PairedTransmitter outside loop to prevent repeated ZMQ socket creation (#268)#294
pradeeban merged 1 commit intoControlCore-Project:devfrom
GaneshPatil7517:fix/zmq-transmitter-lifecycle

Conversation

@GaneshPatil7517
Copy link

@GaneshPatil7517 GaneshPatil7517 commented Feb 12, 2026

@pradeeban

Problem

PairedTransmitter was being created and destroyed inside every loop iteration in 0mq/funcall.py.
This caused excessive ZMQ socket churn, thread creation overhead, and potential port rebinding failures due to TIME_WAIT state.

Solution

  • Moved transmitter initialization and background thread start outside the loop
  • Added try/finally to ensure proper cleanup after loop execution

Impact

  • Improved performance
  • Prevents socket exhaustion
  • Proper resource lifecycle management
  • No functional behavior change

(#268)

Copilot AI review requested due to automatic review settings February 12, 2026 12:22
Copy link

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

This PR improves the resource lifecycle in the 0mq/funcall.py ZMQ client loop by reusing a single PairedTransmitter instance instead of creating/tearing it down every iteration, avoiding repeated socket/thread churn.

Changes:

  • Instantiate PairedTransmitter once before the simulation loop.
  • Start background sync once and stop it once using a try/finally to guarantee cleanup.

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

@pradeeban pradeeban merged commit d3b9f55 into ControlCore-Project:dev Feb 13, 2026
11 of 12 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