Skip to content

error="listen tcp :8080: bind: address already in use" #4

@arykaert

Description

@arykaert

hi,
with the latest code i encounter following problem, which i did not had with the code of 26jan2026

error="listen tcp :8080: bind: address already in use"

how to reproduce:
got a script, mbproxy.sh

#!/bin/sh
ipaddr="$1"
portnr="$2"
echo ". ipaddr: ${ipaddr} - portnr: ${portnr}"
export LOG_LEVEL="INFO"
export MODBUS_LISTEN=":${portnr}"
export MODBUS_UPSTREAM="${ipaddr}:502"

export MODBUS_SLAVE_ID="1"

export MODBUS_CACHE_TTL="10s"
export MODBUS_CACHE_SERVE_STALE="false"
export MODBUS_READONLY="false"
export MODBUS_TIMEOUT="3s"
export MODBUS_REQUEST_DELAY="0"
export MODBUS_CONNECT_DELAY="0"
export MODBUS_SHUTDOWN_TIMEOUT="10s"
/bin/mbproxy

when a launch a first instance

mbproxy.sh 10.1.1.41 40502

==================================================
. ipaddr: 10.1.1.41 - portnr: 40502
time=2026-03-07T00:26:38.265+01:00 level=INFO msg="health server listening" addr=[::]:8080
time=2026-03-07T00:26:38.265+01:00 level=INFO msg="starting proxy" listen=:40502 upstream=10.1.1.41:502 readonly=false cache_ttl=10s
time=2026-03-07T00:26:38.270+01:00 level=INFO msg="connected to upstream" address=10.1.1.41:502

when a lauch a second instance:

mbproxy.sh 10.1.1.51 60502

==================================================
. ipaddr: 10.1.1.51 - portnr: 60502
time=2026-03-07T00:27:47.842+01:00 level=ERROR msg="failed to start health server" error="listen tcp :8080: bind: address already in use"

can you have a look please
many thanks,

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions