An Abandoned sub keeps its entry but reports failure, so a retrying caller gets two entries for one stream
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- api
Research direction
Start by tracing subscribe's AbandonedRequest catch, the subscriptions bookkeeping, and subscribeAll's reconnect path; compare their behavior with ADR-0006. Reproduce an abandoned sub followed by a retry, then verify the chosen behavior leaves one retained entry and one live DDP subscription after reconnect, with unsubscribe affecting the expected entry.
Written by the indexing model from the issue text.
Description
What
subscribe writes the subscription entry for an Abandoned sub and then tells the caller the request failed:
.catch((err) => {
this.logger.error(`[ddp] Subscribe error: ${err.message}`)
if (err instanceof AbandonedRequest) {
this.rememberSubscription(err.id, name, params, callback)
}
return undefined
})
The entry survives, which is what ADR-0006 intends. But the caller receives undefined, which is indistinguishable from the failure modes that leave nothing behind. A caller that responds the obvious way — by subscribing again — gets a second entry for the same stream under a new id, because subscribe mints a fresh id when none is passed.
Both entries then live in subscriptions, and subscribeAll establishes both at the next Login. The result is two live DDP subscriptions on one stream where the app asked for one: duplicate events delivered to the callback, and an unsubscribe that only ends one of them.
Steps to reproduce
- Subscribe to a stream and let the
subframe be written. - End the connection before the DDP response arrives, so the wait is abandoned and the entry is kept.
- Observe
subscriberesolvesundefined. - Subscribe to the same stream and params again, as a caller seeing a failure would.
- Both entries are present in
subscriptionsunder different ids. - Reconnect.
subscribeAllestablishes both.
Worth deciding
Whether the caller should be able to tell "kept, will be re-established" apart from "nothing left behind" — or whether subscribe should recognise an existing entry for the same name and params instead of adding a second. ADR-0006 states that what a caller receives is unchanged and the bookkeeping is its only concern, so the second option may fit the decision better than changing the return.
Why now
This is reachable on its own, but a send on a Socket that is Transport open while its Liveness chain has lapsed now writes the frame instead of failing before the write, which makes an abandoned-after-write sub considerably more common.
- Dominant language
- TypeScript
- Stars
- 146
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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 RocketChat/Rocket.Chat.js.SDK
-
refactor: delete the unused replaceLog and silence exports from lib/log.tsPossibly taken @ayushi-wq claimed this 81 days ago. Openbug ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
RocketChat/Rocket.Chat.js.SDK#380 · 1 comment ·
-
refactor: delete the unassigned messages and joinedIds fields on DriverPossibly taken @arbazkhan971 claimed this 68 days ago. Openbug ready-for-agent
Difficulty 1/5 Under an hour Newbie friendliness 90/100
RocketChat/Rocket.Chat.js.SDK#379 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
RocketChat/Rocket.Chat.js.SDK#308 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RocketChat/Rocket.Chat.js.SDK#306 ·
-
bug
Difficulty 2/5 Half a day Newbie friendliness 78/100
RocketChat/Rocket.Chat.js.SDK#254 ·
All issues in RocketChat/Rocket.Chat.js.SDK
Similar issues
-
Out of order / duplicate key error shows the key bytes as decimal or UTF-8, not hexPossibly taken @bardrop claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
`/leaderboard`, the page and the share image say "be the first" for a program that hasn't startedOpenbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
codercops/discord-bot#152 ·
Maintainers usually reply within 1 day
-
bug i18n
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
endora-commerce/endora-commerce#1315 ·
Maintainers usually reply within 1 day
-
area:data-quality importer size:S
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
enorm-labs/event-junkie#5136 ·
Maintainers usually reply within 1 day
-
fix(scripts): set-device-owner.ps1 fails to parse on Windows PowerShell 5.1 (UTF-8 without BOM)Open
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day