Skip to content

PubSub DataSetMessages using RawData field encoding are not padded to the maximum size indicated by MaxStringLength #3566

@mm-srp

Description

@mm-srp

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

Using the ConsoleReferencePublisher, when sending messages with "DataSetFieldContentMask.RawData" (this is currently used by default), setting a MaxStringLength value for the "String" variable, does not lead to messages of consistent length.

Using WireShark we can see the message length is dependent on the length of the actual string:
Image

The payload is not padded to the configured MaxStringLengthValue, it ends immediately:
Image

Expected Behavior

Whenever DataSetFieldContentMask.RawData is used, a MaxStringLengthValue should be mandatory and messages should be padded to the maximum expected size.

Steps To Reproduce

  1. Adjust Applications/ConsoleReferencePublisher/Program.cs:
  • in CreatePublisherConfiguration_UdpUadp, set Enabled = "false" for dataSetWriter1 as we are not interested in this writer:
var dataSetWriter1 = new DataSetWriterDataType
{
    Name = "Writer 1",
    DataSetWriterId = 1,
    Enabled = false,
    DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData,
    DataSetName = "Simple",
    KeyFrameCount = 1
};
  • in CreatePublishedDataSetAllTypes, remove all FieldMetaData except "String" and add "MaxStringLength = 10" to this FieldMetaData:
new FieldMetaData
{
    Name = "String",
    DataSetFieldId = new Uuid(Guid.NewGuid()),
    BuiltInType = (byte)DataTypes.String,
    DataType = DataTypeIds.String,
    ValueRank = ValueRanks.Scalar,
    MaxStringLength = 10
}
  1. Start the Publisher:
  dotnet run --project ConsoleReferencePublisher.csproj --framework net10.0 -u
  1. Observe payload lengths with Wireshark:
  • The payload lengths are dependent on the length of the string length and not padded to the max. length

Environment

- OS: Linux Mint Debian Edition 7
- Environment: VS Code 1.109.3
- Runtime: .NET 10.0
- Nuget Version: 1.5.378.106
- Component: Opc.Ua.PubSub
- Server: -
- Client: ConsoleReferencePublisher

Anything else?

The expected behaviour is specified here: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.4.5.11
The ConsoleReferenceSubscriber is still able to decode these message fine.
This did however lead to decoding errors on subscribers built on another stack.

Metadata

Metadata

Assignees

Labels

PubSubcomplianceAn issue was found which is not compliant with the OPC UA specification.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions