Duplicate active TCP sockets generated by a single `Modbus_TCP_Slave`

More
3 hours 8 minutes ago #420 by Eduardo
Environment Specs:
  • ProviewR Version: 6.1.5
  • OS: Linux (Debian 12 / Linux Mint)
  • Node / Bus: Development Node under Bus 999 (
    Code:
    plc_wicotas_0999_plc
    )
  • Modbus Gateway: Exemys EGW1 (Modbus TCP to RS-485 converter, IP
    Code:
    10.59.1.50:502
    )
  • Slave Devices: Micro Motion RFT9739 (Unit ID 1), Micro Motion 1700 MVD (Unit ID 3)
Issue Description:Upon starting the runtime process (
Code:
rt_ini &
) after a cold boot, the main PLC process (
Code:
plc_wicotas_0999_plc
) opens two simultaneous active TCP sockets to the Modbus gateway IP
Code:
10.59.1.50:502
. Both sockets actively transmit identical Modbus TCP request streams in parallel, causing frame collisions and delays on the underlying RS-485 serial bus.Diagnostic Evidence:1. Socket Inspection ( ss -tnp )
Code:
ESTAB 0 0 10.59.1.2:60178 10.59.1.50:502 users:(("plc_wicotas_0999_plc",pid=25050,fd=4)) ESTAB 0 24 10.59.1.2:60180 10.59.1.50:502 users:(("plc_wicotas_0999_plc",pid=25050,fd=6))
Both
Code:
Send-Q
and
Code:
Recv-Q
continuously fluctuate on both file descriptors (fd=4 and fd=6), proving that both sockets are actively exchanging traffic with the gateway (neither socket is idle or hanging).2. Payload Analysis ( tcpdump )Decoding the Modbus TCP application layer reveals a 1:1 mirror traffic pattern between local ports
Code:
60178
and
Code:
60180
:
  • Port 60178: Transmits
    Code:
    FC03
    (Read Holding Registers for PDU 246, 258, 244, 1) and
    Code:
    FC05
    (Write Single Coil 3) to Unit ID 1 and Unit ID 3.
  • Port 60180: Transmits identical
    Code:
    FC03
    and
    Code:
    FC05
    request bursts to Unit ID 1 and Unit ID 3 at the exact same intervals.
Verified Workbench Configuration:
  • There is strictly one Modbus_Master and one Modbus_TCP_Slave object under
    Code:
    wicoTAS ➔ IO
    .
  • A single
    Code:
    PlcThread
    (
    Code:
    Plc1
    ) is defined and assigned.
  • Attribute
    Code:
    Process = 1 (PLC)
    is set uniformly across all
    Code:
    Modbus_Module
    objects.
  • A clean build (
    Code:
    Clean Volume
    +
    Code:
    Build Node
    ) was performed, but two sockets continue to open automatically on runtime startup.
Questions for the Community / Developers:
  1. Why does the PLC runtime engine instantiate two independent TCP sockets (
    Code:
    fd=4
    and
    Code:
    fd=6
    ) for a single
    Code:
    Modbus_TCP_Slave
    object?
  2. Does ProviewR separate cyclic transactions (
    Code:
    Continuous = YES
    ) from triggered transactions (
    Code:
    Continuous = NO
    ) into dedicated sockets, or is
    Code:
    io_init()
    being called twice within the multithreaded framework?
  3. What is the recommended configuration to force ProviewR to multiplex all Modbus TCP requests over a single TCP socket descriptor?

Please Log in or Create an account to join the conversation.

More
2 hours 54 minutes ago #421 by Eduardo
Apologies for the formatting issue in the main post!** The forum editor automatically parsed the inline code tags into `Code:` blocks and split some lines, and I am unable to edit the original thread.

To summarize the core environment and issue cleanly:

**PLC Process:** `plc_wicotas_0999_plc` (Bus 999)
**Target Gateway:** Exemys EGW1 (`10.59.1.50:502`)
**Slaves:** Micro Motion RFT9739 (ID 1) & Model 1700 (ID 3)
**Issue:** Executing `rt_ini &` automatically opens two active TCP sockets (`fd=4` and `fd=6`) from the exact same process (`pid=25050`) to `10.59.1.50:502`, sending 1:1 identical Modbus TCP request bursts.

Thank you for your understanding and any guidance on how to resolve this duplicate socket behavior!

Please Log in or Create an account to join the conversation.

Time to create page: 0.829 seconds
Powered by Kunena Forum