Skip to content

Mutex does not protect parallel access to same serial port correctly #9

Open

Description

@SeasDiver

If you have a multidrop serial configuration - multiple devices on same serial port using unique Device IDs, the mutex that is created to protect communications does not work if there are parallel accesses to the Read/Write register functions. The problem is that each Create Serial Master generates a unique Mutex whereas it should be a unique mutex for each serial port, not each device on the serial port. You will not see a problem if using a single device or if all of your register accesses are serialized, but if you parallelize the application, then you can have two different accesses to the same serial port which will screw up communications resulting in error 56.

Activity

  1. SeasDiver commented on Dec 17, 2019

    @SeasDiver
    Author

    Note: This may also occur if you have multiple devices going to different IP Ports on the same TCP IP Address, but I have not tested that use case. It is a rare one and would only occur if you have multiple programs on the same computer offering multiple TCP Modbus interfaces on different ports which would be a fairly unusual use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions