SparkplugNet icon indicating copy to clipboard operation
SparkplugNet copied to clipboard

Issues with sequence number increments in multithreaded code

Open adaptivefrog opened this issue 1 year ago • 1 comments

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.

adaptivefrog avatar Jun 12 '24 11:06 adaptivefrog

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.

SeppPenner avatar Jul 02 '24 13:07 SeppPenner