Skip to content

Modbus: don't guard connection settings with the registry mutex - #32695

Merged
andig merged 3 commits into
masterfrom
fix/modbus-connection-settings-lock
Aug 10, 2026
Merged

Modbus: don't guard connection settings with the registry mutex#32695
andig merged 3 commits into
masterfrom
fix/modbus-connection-settings-lock

Conversation

@andig

@andig andig commented Aug 10, 2026

Copy link
Copy Markdown
Member

Follow-up to #32694.

The shared delay, connect delay and timeout added in #32694 were guarded by the connection registry mutex. That mutex is held while a physical connection is closed, so unregistering one connection could block register access on every other modbus connection. They now use a dedicated mutex per physical connection.

🤖 Generated with Claude Code

unregisterConnection closes the physical connection while holding the registry
mutex. Reading the delay before each register access took the same mutex, so
closing one connection could block requests on all other connections.
@andig andig added the bug Something isn't working label Aug 10, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions github-actions Bot added the devices Specific device support label Aug 10, 2026
Comment thread util/modbus/modbus.go Outdated
@andig
andig enabled auto-merge (squash) August 10, 2026 15:20
@andig
andig merged commit 232d367 into master Aug 10, 2026
9 checks passed
@andig
andig deleted the fix/modbus-connection-settings-lock branch August 10, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working devices Specific device support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant