Skip to content

Fix broker disconnect to better handle SIGPIPE#548

Merged
embhorn merged 1 commit into
wolfSSL:masterfrom
dgarske:broker_dis
Jun 1, 2026
Merged

Fix broker disconnect to better handle SIGPIPE#548
embhorn merged 1 commit into
wolfSSL:masterfrom
dgarske:broker_dis

Conversation

@dgarske

@dgarske dgarske commented May 27, 2026

Copy link
Copy Markdown
Member

No description provided.

@dgarske dgarske self-assigned this May 27, 2026
@dgarske dgarske requested a review from embhorn May 28, 2026 00:24
@dgarske dgarske assigned embhorn and unassigned dgarske May 28, 2026

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #548

Scan targets checked: wolfmqtt-bugs, wolfmqtt-src

Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/mqtt_broker.c
Comment thread tests/test_broker_connect.c Outdated
Comment thread src/mqtt_broker.c
@embhorn embhorn assigned dgarske and unassigned embhorn May 29, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 18:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a broker crash caused by SIGPIPE when writing responses (e.g., PUBREC) to a socket that the peer has already closed, and adds regression coverage around the QoS 2 state-machine path involved in the reported scenario.

Changes:

  • Suppress SIGPIPE in the broker POSIX network layer using MSG_NOSIGNAL (where available) and SO_NOSIGPIPE (macOS/BSD).
  • Add new broker unit tests that exercise QoS 2 publish + immediate disconnect / abrupt close with an offline durable subscriber.
  • Ignore newly built broker test executables in .gitignore.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/mqtt_broker.c Adds SIGPIPE suppression for broker socket writes (MSG_NOSIGNAL / SO_NOSIGPIPE) and installs SIGPIPE ignore in initialization paths.
tests/test_broker_connect.c Extends mock networking to simulate read errors and adds new QoS 2 regression tests for disconnect/abrupt-close scenarios.
.gitignore Ignores broker/unit test binaries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_broker_connect.c
Comment thread tests/test_broker_connect.c Outdated
Comment thread src/mqtt_broker.c
Comment thread src/mqtt_broker.c
Comment thread tests/test_broker_connect.c Outdated
Comment thread tests/test_broker_connect.c Outdated
@dgarske dgarske assigned embhorn and unassigned dgarske Jun 1, 2026
@embhorn embhorn merged commit cba7014 into wolfSSL:master Jun 1, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants