Skip to content

UDP Router using python interface does not disconnect #2163

@ga-rskinner

Description

@ga-rskinner

Describe the bug
When using a router with the Python UDP interface openc3/interfaces/udp_interface.py, selecting disconnect causes it to briefly disconnect then automatically reconnect. This does not happen when using ruby interfaces.

To Reproduce

  1. Modify the docker compose file to expose the following ports:
openc3-operator:
    user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-operator${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: "unless-stopped"
    ports:
    #   - "127.0.0.1:7779:7779" # Open port for the demo router
    #   - "127.0.0.1:8081:8081/udp" # Open a udp port
      - "7779:7779/udp"
      - "8081:8081/udp"
  1. Modify plugin.txt like this (target names and addresses have been changed):
TARGET BOB <%= bob_target_name %>
INTERFACE <%= bob_target_name %>_INT openc3/interfaces/udp_interface.py 172.17.0.1 8081 8081
  MAP_TARGET <%= bob_target_name %>

ROUTER TEAL_ROUTER openc3/interfaces/udp_interface.py 172.17.0.15 7779 7779
  MAP_TARGET <%= bob_target_name %>
  1. Build the plugin - openc3.sh cli rake build VERSION=0.0.1
  2. Open Cosmos in a browser
  3. Navigate to the Admin Console and install the plugin
  4. Navigate to the CmdTlmServer page and select the 'Routers' tab
  5. Select 'Disconnect'
  6. The Router disconnects then reconnects

Expected behavior
The Router should not reconnect

Log Messages

The log messages produce the following error. I am unsure if it is directly related to this issue.
Unexpected process died... respawning! python router_microservice.py DEFAULT__ROUTER__TEAL_ROUTER
Stdout:
{"time":1750779430591545739,"@timestamp":"2025-06-24T15:37:10.591545Z","level":"INFO","microservice_name":"DEFAULT__ROUTER__TEAL_ROUTER","container_name":"42cb7443f325","message":"Microservice initialized with config:
{\"name\"=>\"DEFAULT__ROUTER__TEAL_ROUTER\", \"folder_name\"=>nil, \"cmd\"=>[\"python\", \"router_microservice.py\", \"DEFAULT__ROUTER__TEAL_ROUTER\"], \"work_dir\"=>\"/openc3/python/openc3/microservices\", \"ports\"=>[], \"env\"=>{}, \"topics\"=>[], \"target_names\"=>[\"EWS_SAT\"], \"options\"=>[], \"parent\"=>nil, \"container\"=>nil, \"updated_at\"=>1750779329848795628, \"plugin\"=>\"openc3-cosmos-ews-sat-0.0.7.gem__20250624153527\", \"needs_dependencies\"=>true, \"secrets\"=>[], \"prefix\"=>nil, \"disable_erb\"=>nil, \"ignore_changes\"=>nil, \"shard\"=>0, \"enabled\"=>true}","type":"log"}
{"time": 1750779431042753024, "@timestamp": "2025-06-24T15:37:11.042753Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "Microservice initialized with config:
{'name': 'DEFAULT__ROUTER__TEAL_ROUTER', 'folder_name': None, 'cmd': ['python', 'router_microservice.py', 'DEFAULT__ROUTER__TEAL_ROUTER'], 'work_dir': '/openc3/python/openc3/microservices', 'ports': [], 'env': {}, 'topics': [], 'target_names': ['EWS_SAT'], 'options': [], 'parent': None, 'container': None, 'updated_at': 1750779329848795628, 'plugin': 'openc3-cosmos-ews-sat-0.0.7.gem__20250624153527', 'needs_dependencies': True, 'secrets': [], 'prefix': None, 'disable_erb': None, 'ignore_changes': None, 'shard': 0, 'enabled': True}", "type": "log"}
{"time": 1750779431162703872, "@timestamp": "2025-06-24T15:37:11.162704Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "Retrieving DEFAULT/target_archives/EWS_SAT/EWS_SAT_current.zip from targets bucket", "type": "log"}
{"time": 1750779431170862848, "@timestamp": "2025-06-24T15:37:11.170863Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "Processing python target definition in file '/tmp/tmpmz2zmeu7/targets/EWS_SAT/target.txt'", "type": "log"}
{"time": 1750779431175663104, "@timestamp": "2025-06-24T15:37:11.175663Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: Starting packet reading", "type": "log"}
{"time": 1750779431175848960, "@timestamp": "2025-06-24T15:37:11.175849Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: Connect 192.168.0.15:7779 (write dest port) 192.168.0.15:7779 (read)", "type": "log"}
{"time": 1750779431176284928, "@timestamp": "2025-06-24T15:37:11.176285Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: Connection Success", "type": "log"}
{"time": 1750780296284729856, "@timestamp": "2025-06-24T15:51:36.284730Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: Disconnect requested", "type": "log"}
{"time": 1750780296285267200, "@timestamp": "2025-06-24T15:51:36.285267Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: read_interface requested disconnect", "type": "log"}
{"time": 1750780296285323008, "@timestamp": "2025-06-24T15:51:36.285323Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: Internal disconnect requested (returned None)", "type": "log"}
{"time": 1750780296285345024, "@timestamp": "2025-06-24T15:51:36.285345Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: Connection Lost", "type": "log"}
{"time": 1750780296291975936, "@timestamp": "2025-06-24T15:51:36.291976Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: shutdown requested", "type": "log"}
{"time": 1750780296292072960, "@timestamp": "2025-06-24T15:51:36.292073Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: stop requested", "type": "log"}
{"time": 1750780296294064128, "@timestamp": "2025-06-24T15:51:36.294064Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "TEAL_ROUTER: Stopped packet reading", "type": "log"}
{"time": 1750780296294411008, "@timestamp": "2025-06-24T15:51:36.294411Z", "level": "INFO", "microservice_name": "DEFAULT__ROUTER__TEAL_ROUTER", "container_name": "42cb7443f325", "message": "Shutting down microservice: DEFAULT__ROUTER__TEAL_ROUTER", "type": "log"}

Stderr: Environment (please complete the following information):

Environment (please complete the following information):

OS: Kubuntu 24.10
OpenC3 COSMOS Version 6.5
Browser: Firefox

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions