SparkplugNet
SparkplugNet copied to clipboard
Issues with sequence number increments in multithreaded code
When sending node device data messages from a from different threads, there is a risk of sending several data messages with same sequence number.
Typical example: Each "device" is managed in it's own thread. If they send data messages at the same time, they might send data messages with the same sequence number. The chance of this to happen increases with the device activity.
I can see the issue in the SparkplugNodeBase.PublishMessageForDevice method.
This is true as the code isn't threadsafe. I didn't think it was required to be, but if there is a use case.