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 incorrect msg/thread counters #542

Merged
merged 4 commits into from
Sep 10, 2023
Merged

Conversation

hloeung
Copy link
Collaborator

@hloeung hloeung commented Sep 3, 2023

When using mattericd's default threading, the msgMap is populated with message/thread IDs and never removed. This means that when we cycle past 4k, we can have entries with duplicate counters causing issues where replies could end up to an incorrect thread.

This fixes it by introducing an index with the counter and to which message/thread ID. When index entries are updated and the thread no longer referenced, the entries in the msgMap are removed.

This also ensures that msgMap remains a constant bounded size.

It should be noted that this also relies on #544, in particular https://github.com/42wim/matterircd/blob/master/mm-go-irckit/server_commands.go#L665

@hloeung hloeung force-pushed the msgcounter-lock branch 8 times, most recently from 0ac9283 to c80eb79 Compare September 4, 2023 05:19
@hloeung hloeung force-pushed the msgcounter-lock branch 3 times, most recently from bfdad41 to e27b4cc Compare September 6, 2023 23:29
When using mattericd's default threading, the msgMap is populated with
message/thred IDs and never removed. This means that when we cycle
past 4k, we can have entries with duplicate counters causing issues
when replying to threads.

This fixes it by introducing an index.
@hloeung hloeung force-pushed the msgcounter-lock branch 2 times, most recently from 901c035 to 523a108 Compare September 8, 2023 05:41
This is so we don't get something like same counter for both parent
and message when wrapping past the maximum counter value.

e.g.

| |15:54 <@bob> [↪005,005] my message ...
@hloeung hloeung marked this pull request as ready for review September 8, 2023 08:42
@hloeung hloeung requested a review from 42wim September 8, 2023 08:47
@hloeung hloeung merged commit 8adbbd3 into 42wim:master Sep 10, 2023
@hloeung hloeung deleted the msgcounter-lock branch September 10, 2023 01:28
@42wim 42wim added this to the 0.28.0 milestone Oct 24, 2023
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.

2 participants