Skip to content

TcpClientPort socket bind failed with error: 98 #116

@yj-Tang

Description

@yj-Tang

Bug Report

Cosys-AirSim Version: branch 5.4
UE/Unity Version: (Docker image) airsim_source:dev-slim-5.4.3
OS Version: Ubuntu 24.04

Issue Description

AirSim fails to establish a connection with PX4.
I launched the drone simulation in Unreal and then started PX4 to control the drone. According to the logs, the simulator initially connects to PX4 via TCP port 4560, but AirSim subsequently crashes.

In the Unreal log, I found the following error message:

TcpClientPort socket bind failed with error: 98

I came across a similar issue in the original AirSim repository. Interestingly, when I tested with UE4.27, everything worked fine, so this might be related to changes or missing updates that need to be merged from the main AirSim repo.

At this point, I’m not entirely sure what’s causing the crash.

Airsim Settings

    {
        "SettingsVersion": 2.0,
        "SimMode": "Multirotor",
        "ClockType": "SteppableClock",
        "Vehicles": {
            "PX4": {
                "VehicleType": "PX4Multirotor",
                "UseSerial": true,
                "LockStep": true,
                "Sensors":{
                    "Barometer":{
                        "SensorType": 1,
                        "Enabled": true,
                        "PressureFactorSigma": 0.0001825
                    }
                },
                "Parameters": {
                    "NAV_RCL_ACT": 0,
                    "NAV_DLL_ACT": 0,
                    "COM_OBL_ACT": 1,
                    "LPE_LAT": 47.641468,
                    "LPE_LON": -122.140165
                }
            }
        }
    }

How can the issue be reproduced?

  1. Run the example: /home/ue4/UnrealEngine/Engine/Binaries/Linux/UnrealEditor /home/ue4/Cosys-AirSim/Unreal/Environments/Blocks/Blocks.uproject
  2. Start airsim simulation in UE with the setting above.
  3. Launch PX4: 'make px4_sitl_default none_iris'
    The new environment will load but there will be no MavLinkConnection.

Include full error message in text form

px4

root@inspur:/home/tang/dev/PX4-Autopilot# make px4_sitl none_iris 
[0/1] launching px4 none_iris (SYS_AUTOSTART=10016)

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
env SYS_AUTOSTART: 10016
INFO  [param] selected parameter default file parameters.bson
INFO  [param] importing from 'parameters.bson'
INFO  [parameters] BSON document size 115 bytes, decoded 115 bytes (INT32:2, FLOAT:3)
INFO  [param] selected parameter backup file parameters_backup.bson
  SYS_AUTOCONFIG: curr: 0 -> new: 1
  SYS_AUTOSTART: curr: 0 -> new: 10016
  CAL_ACC0_ID: curr: 0 -> new: 1310988
  CAL_ACC1_ID: curr: 0 -> new: 1310996
  CAL_GYRO1_ID: curr: 0 -> new: 1310996
  CAL_ACC2_ID: curr: 0 -> new: 1311004
  CAL_GYRO2_ID: curr: 0 -> new: 1311004
  CAL_MAG0_ID: curr: 0 -> new: 197388
  CAL_MAG0_PRIO: curr: -1 -> new: 50
  CAL_MAG1_ID: curr: 0 -> new: 197644
  CAL_MAG1_PRIO: curr: -1 -> new: 50
  SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
  SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
INFO  [dataman] data manager file './dataman' size is 1208528 bytes
INFO  [init] PX4_SIM_HOSTNAME: 172.17.0.1
INFO  [simulator_mavlink] using TCP on remote host 172.17.0.1 port 4560
WARN  [simulator_mavlink] Please ensure port 4560 is not blocked by a firewall.
INFO  [simulator_mavlink] Waiting for simulator to accept connection on TCP port 4560

airsim

[2025.10.20-08.01.00:292][ 29]LogLinker: Warning: [AssetLog] /home/ue4/Cosys-AirSim/Unreal/Environments/Blocks/Plugins/AirSim/Content/Models/QuadRotor1/Material_001.uasset: Asset has been saved with empty engine version. The asset will be loaded but may be incompatible.
Opening mavlink connection
Disconnecting mavlink vehicle
[2025.10.20-08.01.00:320][ 29]LogTemp: Opening mavlink connection
[2025.10.20-08.01.00:320][ 29]LogTemp: Disconnecting mavlink vehicle
Waiting for mavlink vehicle...
Disconnecting mavlink vehicle
[2025.10.20-08.01.00:320][ 29]LogTemp: Waiting for mavlink vehicle...
Waiting for TCP connection on port 4560, local IP 127.0.0.1
[2025.10.20-08.01.00:321][ 29]LogTemp: Disconnecting mavlink vehicle
[2025.10.20-08.01.00:321][ 29]LogTemp: Waiting for TCP connection on port 4560, local IP 127.0.0.1
[2025.10.20-08.01.00:418][ 29]LogScript: Warning: Script Msg: Attempted to access index 0 from array 'CallFunc_GetAllActorsOfClass_OutActors' of length 0 in '/AirSim/Weather/WeatherFX/WeatherActor.WeatherActor_C:ExecuteUbergraph_WeatherActor'!
[2025.10.20-08.01.00:418][ 29]LogScript: Warning: Script Msg called by: WeatherActor_C /Game/FlyingCPP/Maps/UEDPIE_0_FlyingExampleMap.FlyingExampleMap:PersistentLevel.WeatherActor_C_0
[2025.10.20-08.01.00:426][ 29]LogTemp: Warning: AirSim Annotation [InstanceSegmentation]: No annotation in the scene to show.
airsimvehicle
[2025.10.20-08.01.00:427][ 29]LogTemp: airsimvehicle
[2025.10.20-08.01.00:438][ 29]PIE: Server logged in
[2025.10.20-08.01.00:439][ 29]PIE: Play in editor total start time 0.245746 seconds.
[2025.10.20-08.01.00:448][ 29]LogStaticMesh: Display: Waiting on static mesh StaticMesh /AirSim/Models/QuadRotor1/Propeller.Propeller being ready before playing
[2025.10.20-08.01.00:448][ 29]LogStaticMesh: Display: Waiting on static mesh StaticMesh /AirSim/Models/QuadRotor1/Quadrotor1.Quadrotor1 being ready before playing
Connected to SITL over TCP.
Connecting to PX4 Control UDP port 14540, local IP 127.0.0.1, remote IP 127.0.0.1 ...
[2025.10.20-08.01.11:603][101]LogTemp: Connected to SITL over TCP.
received first heartbeat
[2025.10.20-08.01.11:603][101]LogTemp: Connecting to PX4 Control UDP port 14540, local IP 127.0.0.1, remote IP 127.0.0.1 ...
[2025.10.20-08.01.11:603][101]LogTemp: received first heartbeat
Ground control connected over UDP.
[2025.10.20-08.01.11:604][101]LogTemp: Ground control connected over UDP.
Exception sending messages to vehicle
No magnetometer with name  exist on vehicle
Disconnecting mavlink vehicle
[2025.10.20-08.01.11:605][101]LogTemp: Exception sending messages to vehicle
[2025.10.20-08.01.11:605][101]LogTemp: No magnetometer with name  exist on vehicle
[2025.10.20-08.01.11:605][101]LogTemp: Disconnecting mavlink vehicle
Waiting for mavlink vehicle...
Disconnecting mavlink vehicle
[2025.10.20-08.01.12:612][101]LogTemp: Waiting for mavlink vehicle...
Waiting for TCP connection on port 4560, local IP 127.0.0.1
[2025.10.20-08.01.12:612][101]LogTemp: Disconnecting mavlink vehicle
[2025.10.20-08.01.12:612][101]LogTemp: Waiting for TCP connection on port 4560, local IP 127.0.0.1
Accepting TCP socket failed, is another instance running?
TcpClientPort socket bind failed with error: 98
[2025.10.20-08.01.12:612][101]LogTemp: Accepting TCP socket failed, is another instance running?
[2025.10.20-08.01.12:612][101]LogTemp: TcpClientPort socket bind failed with error: 98


[2025.10.20-08.02.41:236][367]LogDerivedDataCache: /home/ue4/.config/Epic/UnrealEngine/Common/DerivedDataCache: Maintenance finished in +00:00:00.001 and deleted 0 files with total size 0 MiB and 0 empty folders. Scanned 0 files in 1 folders with total size 0 MiB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions