MQTT "Session disconnected while trying to send message to" error drops the topic
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, node.js
- Domain
- backend, observability
Research direction
The error is raised in server/mqtt.ts around line 551. Read the delivery listener and check how it handles disconnected sessions and logs this error; the issue also raises whether the expected disconnect race should be logged at error level. Done when the message includes the topic and session/client id, and the logging level decision is addressed.
Written by the indexing model from the issue text.
Description
The MQTT delivery listener builds its error as:
if (disconnected) throw new Error('Session disconnected while trying to send message to', topic);
(server/mqtt.ts:551). Error's second argument is an options object, not a message part, so the topic is dropped and every log line reads "Session disconnected while trying to send message to" with nothing after it. On a busy MQTT deployment this line is logged hundreds of thousands of times a week with no way to tell which topic or session it came from.
Fix: put the topic (and the session/client id) in the message. Also worth checking whether this case should log at error level at all: a delivery racing a disconnect is expected under normal client churn.
Present in v5.2.x, v5.3.x and main.
- Dominant language
- JavaScript
- Stars
- 90
- Forks
- 15
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 287
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HarperFast/harper
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
HarperFast/harper#3330 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
HarperFast/harper#3312 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
HarperFast/harper#3304 ·
Maintainers usually reply within 1 day
-
CI: the LMDB unit leg runs no unitTests/server suite, so MQTT durable-session tests never run on LMDBPossibly taken @sudarshan24-10 claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
HarperFast/harper#3275 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
HarperFast/harper#3261 · 1 comment ·
Maintainers usually reply within 1 day
All issues in HarperFast/harper
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
oskarrough/dodgethis#115 ·
Maintainers usually reply within 1 day
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefixPossibly taken @ItsDeadlyProgrammer claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
appsmithorg/appsmith#42471 · 1 comment ·
Maintainers usually reply within 2 days
-
external-plugin requires-submitter-fixes
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
github/awesome-copilot#5396 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
chenasraf/nextcloud-forum#348 ·
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
melodic-software/claude-code-plugins#9619 ·
Maintainers usually reply within 1 day