Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Potential forever loop during receive (in both sync and async API version) #80

Open
horeich opened this issue Sep 12, 2022 · 0 comments

Comments

@horeich
Copy link

horeich commented Sep 12, 2022

Hi,

is there a reason, why we read the incoming frame in a while loop? Looks potentially dangerous to me.

while (true)

Why do we not simply define a serial timeout which defines the "receive window" and simply wait for a timeout or invalid data (which is accounted for by ModbusUtils.DetectFrame)? Per definition a Modbus frame should arrive as a continuous block (please correct me if I'm wrong).

Currently the implementation may get stuck in the while loop if we receive a continuous data stream via the serial port which is not detected as a valid frame (as the buffer will be reset if it is full). At least, we should handle a full frame buffer differently.

Same applies to the async version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant