Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Read receipts duplicate key error #18560

Merged
merged 5 commits into from
Aug 18, 2020
Merged

[FIX] Read receipts duplicate key error #18560

merged 5 commits into from
Aug 18, 2020

Conversation

galshiff
Copy link
Contributor

@galshiff galshiff commented Aug 14, 2020

Proposed changes

The receipt duplicate key error bug crashes the rocket chat instance because this exception is not being catch by the 'try-catch' block.
The fix is to catch this exception on the callback of insertMany.

Issue(s)

#17045

How to test or reproduce

This bug occurs from time to time on regular base inside chats...
I also managed to reproduce this bug sometimes when I marked as unread a chat from the sidebar,
and then I returned to this chat and got the duplicate key error message & my RC instance crashed.

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Hotfix (a major bugfix that has to be merged asap)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Changelog

Fixed receipt duplicate key error bug

Further comments

Copy link
Member

@sampaiodiego sampaiodiego left a comment

Choose a reason for hiding this comment

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

that's an awesome find @galshiff .. thank you!

I was able to reproduce the issue doing what you described, marking room as unread and then coming back and sending a message right away.. good catch 👍

please look at my code comments.. thx again

imports/message-read-receipt/server/lib/ReadReceipt.js Outdated Show resolved Hide resolved
@sampaiodiego sampaiodiego changed the title [FIX] Receipt duplicate key error bug crashes rocket chat instance [FIX] Read receipts duplicate key error Aug 18, 2020
@sampaiodiego sampaiodiego merged commit ecf3819 into RocketChat:develop Aug 18, 2020
@sampaiodiego sampaiodiego mentioned this pull request Aug 29, 2020
@phriedrich
Copy link

Not sure if it's related, but after the Update to 3.6 I see this problem: #18689

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.

3 participants