chatmail / chatmail/core

Messages referencing other messages can't be received if they appear earlier on another transport

Open
#8,372 0 comments 0 reactions 1 assignee Claimed by @iequidoo View on GitHub
bug
Dominant language
Rust
Stars
929
Forks
143
Avg merge
1d 20h
Merged PRs (30d)
53

Description

In case of multi-transport, shortly after publishing a new transport, it's possible that a new message referencing another message appears on the new transport earlier than the referenced message on the old transport. In this case usually a tombstone is created, so when both messages arrive from the old transport in the right order, the referencing message isn't received because `imap::prefetch_should_download()` returns false for it. This problem exists for:
- `SyncData::SaveMessage` and other kinds of sync messages -- discussed in #7984 . Should be fixed separately, see https://github.com/chatmail/core/issues/7984#issuecomment-4328731178 for reasoning.
- Reaction messages -- should be fixed separately: #8367
- Webxdc status updates
- `Iroh-Node-Addr` messages (realtime advertisements)
- `Chat-Edit` messages (text edits)
- Self-MDNs (i.e. ones BCC'd to self for synchronization of seen messages)

For message deletion requests the bug is already fixed: #8158 .

The most simple fix probably is to not create a tombstone for a possibly out-of-order message. Luckily, almost all these kinds of messages are small (except webxdc status updates), so receiving them several times isn't a problem. However, this won't fix a case when messages just appear on different transports and aren't duplicated, which may happen if one contact sends to the old transport and another contact -- to the new one. For reactions #8367 proposes to fix this scenario as well. Maybe we should generalize the solution proposed there and add some `msgs_pending` table instead of `reactions_pending`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.