thiagoralves / OpenPLC_v3

OpenPLC Runtime version 3
1.06k stars 432 forks source link

Modbus Slaves "Floating Point Exception" and "SIGFPE, Arithmetic Exception" #170

Closed koztkozt closed 2 years ago

koztkozt commented 2 years ago

Openplc runtime stops when it attempts to connect to Modbus Slave.

Logs on webgui showed OpenPLC runtime stopped every time i tried to Start PLC image

Attempted to run ./core/openplc and found that it was throwing 'Floating Point Exception' image

Added "g" flag to g++ complier in compile_program.sh and recompiled openplc for analysis with gdb image

GDB flags line 421 in modbus_master.cpp. It seems to be a division by zero error. image

Below is the modbus slave device setting. Note that baud rate is not set for Modbus TCP slave. image

I am seeing this error only when running OpenPLC docker on my Windows host. There was no error when i ran the same OpenPLC docker on my Ubuntu Host. Not sure why division by zero was not flagged by the openplc program.

Should be an easy fix.