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

"Ignoring duplicate event" is logged each time the sdk sends an event #2618

Closed
BurnyBoi opened this issue Aug 23, 2022 · 4 comments · Fixed by #2639
Closed

"Ignoring duplicate event" is logged each time the sdk sends an event #2618

BurnyBoi opened this issue Aug 23, 2022 · 4 comments · Fixed by #2639
Assignees

Comments

@BurnyBoi
Copy link

BurnyBoi commented Aug 23, 2022

Describe the bug
I have an image bot that sends an image based on user input. I've noticed since updating to a recent matrix-js-sdk that whenever I send an event with the SDK, it logs a line that says EventTimelineSet.addLiveEvent: ignoring duplicate event $event_id, where $event_id is the event sent by the sdk.

To Reproduce
This is the simplified version of the code I am using with matrix-js-sdk 19.3.0 to reproduce the issue:

const sdk = require("matrix-js-sdk");
const matrixcs = require("matrix-js-sdk/lib/matrix");
const request = require('request');
matrixcs.request(request);

const log = require('loglevel');
const { logger} = require('matrix-js-sdk/lib/logger');
logger.setLevel(log.levels.INFO, false);

var myUserId = "@test:matrix.example.com";
var myAccessToken = "syt_token";
var matrixClient = sdk.createClient({
    baseUrl: "https://matrix.example.com",
    accessToken: myAccessToken,
    userId: myUserId
});

matrixClient.on("Room.timeline", function(event, room, toStartOfTimeline) {

	if (event.getType() === "m.room.message" && event.getContent().body.indexOf("!cot") === 0) {
                matrixClient.sendImageMessage(room.roomId, "mxc://matrix.org/SZcQxxckvdxdzbIeiSurDEng", {"mimetype": "image/png"}, "cot.png", null);
        }

});

matrixClient.startClient({initialSyncLimit: 0});

Once running, invite the account to a test room, then send !cot in the room with any other account.

Expected behavior
The "ignoring duplicate event" line shouldn't get logged.

Actual behavior
This is the output I get when sending !cot in the room and having the bot send the image:

$ node ./test.js
EventTimelineSet.addLiveEvent: ignoring duplicate event $-W_XVQn5UotOvWC3F7-gZfaWc5Boim3hI28labr-8ys

Desktop (please complete the following information):

  • OS: Arch Linux
  • Browser Firefox
  • Version 103
@3nprob
Copy link
Contributor

3nprob commented Aug 28, 2022

If this is indeed a bug it might be from #2587 (comment) and #2586

@3nprob
Copy link
Contributor

3nprob commented Aug 28, 2022

So the currently broken deepCompare is now called in

filterId = await this.client.getOrCreateFilter(getFilterName(this.client.credentials.userId), filter);
so it looks related indeed.

@t3chguy not sure why you were removed as reviewer on #2586 as it concerns code you were directly calling there as mentioned in this comment prior to #2587 being merged.

(Aside but I find it kind of wild that this underlying bug has been unnoticed for >6y and I only discovered it by chance when browsing the code, filing the bug and fix 23 minutes before the PR triggering it was opened 🤯 )

@3nprob
Copy link
Contributor

3nprob commented Aug 30, 2022

Sorry, realized now you are on v19.3.0, which does not contain the recent changes referred to. If the previous version uses deepCompare in a similar way it could be the same underlying bug - have not confirmed that.

@t3chguy
Copy link
Member

t3chguy commented Sep 1, 2022

@3nprob yes, sync.ts has been using filterId = await this.client.getOrCreateFilter(getFilterName(this.client.credentials.userId), filter); before my recent commits.

@t3chguy t3chguy self-assigned this Sep 5, 2022
su-ex added a commit to SchildiChat/matrix-js-sdk that referenced this issue Sep 28, 2022
* Add a property aggregating all names of a NamespacedValue ([\matrix-org#2656](matrix-org#2656)).
* Implementation of MSC3824 to add action= param on SSO login ([\matrix-org#2398](matrix-org#2398)). Contributed by @hughns.
* Add invited_count and joined_count to sliding sync room responses. ([\matrix-org#2628](matrix-org#2628)).
* Base support for MSC3847: Ignore invites with policy rooms ([\matrix-org#2626](matrix-org#2626)). Contributed by @Yoric.
* Fix handling of remote echoes doubling up ([\matrix-org#2639](matrix-org#2639)). Fixes matrix-org#2618.
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 a pull request may close this issue.

3 participants