Skip to content

Python System.connect() hangs because AsyncPluginManager.channel_ready() never returns (gRPC server never listens on port 50051) #822

Description

@ShotaShimazu

Environment

  • OS:
    • Windows 11
    • Raspberry Pi OS (same behavior)
  • Python:
    • 3.13.5
    • 3.14.3
  • mavsdk (Python):
    • 3.15.3
  • bundled mavsdk_server:
    • v3.15.0

Expected behavior

await drone.connect() should return after the backend is started.


Actual behavior

await drone.connect() never returns.

After debugging, it blocks in:

await self._channel.channel_ready()

inside AsyncPluginManager._connect_backend().

The gRPC channel state becomes:

IDLE
CONNECTING
TRANSIENT_FAILURE

and never reaches READY.


Minimal example

import asyncio
from mavsdk import System

async def run():
    drone = System()

    print("before connect")

    await drone.connect(
        system_address="udpin://0.0.0.0:14540"
    )

    print("after connect")

asyncio.run(run())

Output:

before connect

The program hangs forever.


Debugging results

I added debug prints inside AsyncPluginManager:

self._channel = aio.insecure_channel(f"{self.host}:{self.port}")

await self._channel.channel_ready()

Execution stops at:

await self._channel.channel_ready()

I also inspected grpc itself.

The connectivity states are:

IDLE
CONNECTING
TRANSIENT_FAILURE

mavsdk_server

Running manually:

mavsdk_server -p 50051 udpin://0.0.0.0:14540

Output:

[Info ] MAVSDK version: v3.15.0
[Info ] Waiting to discover system on udpin://0.0.0.0:14540...

Heartbeat is successfully received:

New system on: ...
Vehicle type changed...

Network investigation

mavsdk_server.exe opens UDP port 14540 correctly.

However, it never listens on TCP port 50051.

Windows:

netstat -ano | findstr 50051

returns nothing.

netstat -abno shows:

UDP 0.0.0.0:14540
    [mavsdk_server.exe]

but there is no TCP listener owned by mavsdk_server.exe.


Additional information

This happens on:

  • Windows 11
  • Raspberry Pi OS

I also tested:

  • Python 3.13
  • Python 3.14
  • mavsdk 3.10.2
  • mavsdk 3.15.3

The behavior is identical.

Is this a known issue, or is there something I am missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions