Skip to content

[PubSub] Thread pool exhaustion issues for many writer groups #2393

@jnsjll

Description

@jnsjll

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

I am running into thread pool starvation issues when publishing to a couple (~50) of MQTT topics.

Expected Behavior

Publishing to a larger amount of topics works without thread pool starvation / hiccups.

Steps To Reproduce

Here is a fork of the starter kit that reproduces the issue:
https://github.com/jnsjll/UA-IIoT-StarterKit

Environment

- OS: Windows 10
- Environment:
- Runtime: .NET 6
- Nuget Version:
- Component: PubSub
- Server:
- Client:

Anything else?

The problem seems to be that the IntervalRunner used for each WriterGroupDataType / UaPublisher calls the PublishMessages method on a thread pool thread which will block on a lock in MqttPubSubConnection.PublishNetworkMessage:
268619809-b9334de6-8c82-47db-abbb-f838f6a07d4d

Making the methods async and awaiting rather than blocking can resolve the issue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions