s7comm failed to read batch
# umh-support
d
unfortunately the disconnection in the logs are by now overwritten. only thing it says in the logs are: level=error msg="Failed to read message: Failed to read batch 1: Connection to address 192.168.26.100:102 is null. Reconnecting..." @service=benthos label="" path=root.input
j
can you share your setup of the protocol converter for that please? i think i know this issue, but want to investigate if it's due to the setup
d
Copy code
yaml
s7comm:
    tcpDevice: '192.168.26.100' # IP address of the Siemens S7 PLC
    rack: 0                  # Rack number of the PLC. Defaults to 0
    slot: 2                  # Slot number of the PLC. Defaults to 1
    batchMaxSize: 480        # Maximum number of addresses per batch request. Defaults to 480
    timeout: 10              # Timeout in seconds for connections and requests. Default to 10
    disableCPUInfo: true    # Set to true to not fetch CPU information from the PLC
    addresses:
      - "DB8.I94"
Copy code
yaml
# these variables are autogenerated from your instance location
let enterprise = "Autoform"
let site = "Malung"
let area = "none"
let line = "none"
let workcell = "138"
let schema = "_local"

      let value = content().string() # Change this to content().number() if you want to parse the value as number
      let tagname = match meta("s7_address") {
        "DB8.I94" => "actCycleTime"
_ => meta("s7_address")
}

# the rest from here here on will be autogenerated, see also documentation
atm it refuses to connect but running nmap manually i have response.. There are something strange going on with the NAT i guess..
j
Are you using custom benthos ?
d
no. i deploy it from mgnt console
i tried deploying a custom benthos now but i get the same problem.. I will have to plug in my laptop and see what is happening.
j
Yeah i think this issue is due to your network/firewall setup, custom-benthos won't help you here. I was just checking on something else here
d
i cannot figure out what is causing the problem. I did quite extensive tests on my desktop with a new plc and the same router and everything worked perfect.
j
is the port for the new plc also on filtered?
d
not sure. did not run nmap on that.
i have changed the NAT not to all ports and removed the firewall.. now it seems to work.
i do however want to limit the access to the plc.
ok. so this was really interesting. it looks like it uses port 54 internally on the plc network. I had to do a NAT for that as well and allow the local firewall to accept port 54.
j
and this helped to get it working for you ?
d
yes. now it connects direct on the first attempt and the status is green most of the time. it sometimes show 500ms delay but then it jumps back to 1ms.
j
if you go to your instances (in ManagementConsole) and click on it -> click on configure, what does the "Version Overview" say about your benthos umh version ?
d
0.5.2
now i got reconnection error again after the machine has been shut down.
Copy code
bash
2025-02-25T14:16:23.379591964Z level=info msg="Launching a Benthos instance, use CTRL+C to close" @service=benthos
2025-02-25T14:16:23.397449483Z level=info msg="Successfully connected to S7 PLC at 192.168.26.100" @service=benthos label="" path=root.input
2025-02-25T14:16:23.397465483Z level=info msg="Input type s7comm is now active" @service=benthos label="" path=root.input
2025-02-25T22:30:17.508706440Z 2025/02/25 22:30:17 *net.OpError read tcp 10.42.0.40:54084->192.168.26.100:102: i/o timeout
2025-02-25T22:30:17.508789925Z level=error msg="Failed to read message: Failed to read batch 1: read tcp 10.42.0.40:54084->192.168.26.100:102: i/o timeout. Reconnecting..." @service=benthos label="" path=root.input
2025-02-25T22:30:17.599371068Z level=error msg="Failed to read message: Failed to read batch 1: Connection to address 192.168.26.100:102 is null. Reconnecting..." @service=benthos label="" path=root.input
2025-02-25T22:30:17.737457350Z level=error msg="Failed to read message: Failed to read batch 1: Connection to address 192.168.26.100:102 is null. Reconnecting..." @service=benthos label="" path=root.input
2025-02-25T22:30:18.032238120Z level=error msg="Failed to read message: Failed to read batch 1: Connection to address 192.168.26.100:102 is null. Reconnecting..." @service=benthos label="" path=root.input
`
if i redeploy or restart benthos it connects again.
j
Are you able to upgrade you instance to a newer version? If yes do that, if not go into your settings, activat the advanced mode and go to the Protocol Converter Settings. Then where it says "benthos-version" write
latest
. That should solve the issue
d
the instance is upgraded to latest in nightly. in the protocol converter does it not default to latest ?
j
no it defaults to your benthos-umh version which said 0.5.2 for your case
d
ah. i see. ok, i have changed to latest now so i will se tomorrow if it works.
j
yeah, just let me know
d
i will.
So with the latest benthos it works.. Now it reconnects by it self when the machine is turned on again.
j
glad to hear that!
d
one problem down. 20 to go. 🙈
2 Views