-
Notifications
You must be signed in to change notification settings - Fork 616
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
Duplicate messages when bridging IRC/ZNC to Telegram after some days #1564
Comments
I've got some debug logs I can provide on request. |
@hashworks if it still an issue, debug logs could be handy. It's probably the ZNC bouncer that maybe replays messages? |
I've sent you debug logs from 2021-08-21 by mail. I've also re-activated the debug logs on my end, but I don't want to run it like that forever – the bug occurs once every few weeks and |
Well, according to the debug log it's receiving those duplicate messages from the irc server, so I think its your ZNC that's causing it. Matterbridge itself doesn't cache those messages so it can't generate duplicate messages itself. Is there an option to do this without ZNC, just let matterbridge connect directly to the IRC server? |
I have been seeing the same issue with a matterbridge bot that I run for Wikimedia projects. Today I spent some quality time with the logs from that bot and I think I have figured out why the duplication happens. The basic issue is that when ZNC gets disconnected from an upstream IRC network matterbridge does not get disconnected from the ZNC instance. Later when ZNC is again connected to the upstream IRC network the bot sees a set of messages from the IRC server (proxied by ZNC) including the events which tell matterbridge that a new IRC session has started. When
In the case of my bot, not really? I added the ZNC to help with numerous issues of the bot's IRC client failing to reconnect cleanly and entering crash loops which triggered bans from libera.chat. See https://phabricator.wikimedia.org/T264212 and https://phabricator.wikimedia.org/T292640 for additional context if desired. All of the connection storm issues stopped immediately with the introduction of ZNC as an intermediate to the libera.chat servers. I wonder if a fix is a simple as adding a call to |
Clear all existing IRC event handler registrations before registering new handlers in case we are connecting via a BNC and are seeing a reconnect. Fixes 42wim#1564
Clear all existing IRC event handler registrations before registering new handlers in case we are connecting via a BNC and are seeing a reconnect. Fixes #1564
Thanks! |
My #1795 patch does not seem to actually fix this bug. I just deployed the v1.25.1 containing the proposed fix and was able to recreate the double IRC client event notification by issuing a |
This bug makes the bridge virtually unusable for me at the moment. Room users (IRC - Matrix in my case) aren't happy to have duplicate messages until I wake up and fix it by restarting, so it's a serious issue for me. Is there any news since the last patch getting reverted? It's been a while. In addition, should this bug really be marked as "closed", given the patch that originally closed it has been reverted? |
I use Matterbridge with ZNC. I haven't seen duplicate messages yet. Calling diff --git a/bridge/irc/handlers.go b/bridge/irc/handlers.go
index 74db7685..9080a6f7 100644
--- a/bridge/irc/handlers.go
+++ b/bridge/irc/handlers.go
@@ -122,6 +122,15 @@ func (b *Birc) handleNewConnection(client *girc.Client, event girc.Event) {
i := b.i
b.Nick = event.Params[0]
+ i.Handlers.Clear("PRIVMSG")
+ i.Handlers.Clear("CTCP_ACTION")
+ i.Handlers.Clear(girc.RPL_TOPICWHOTIME)
+ i.Handlers.Clear(girc.NOTICE)
+ i.Handlers.Clear("JOIN")
+ i.Handlers.Clear("PART")
+ i.Handlers.Clear("QUIT")
+ i.Handlers.Clear("KICK")
+ i.Handlers.Clear("INVITE")
i.Handlers.AddBg("PRIVMSG", b.handlePrivMsg)
i.Handlers.AddBg("CTCP_ACTION", b.handlePrivMsg)
i.Handlers.Add(girc.RPL_TOPICWHOTIME, b.handleTopicWhoTime) My ZNC configuration mostly uses the defaults. I haven't changed any buffer sizes. My networks load nothing but an authentication module and stickychan.
The corresponding Matterbridge configuration: [irc.libera]
Nick="example"
Password="example/libera:secret"
Server="127.0.0.1:6667"
Charset="utf-8"
NoSendJoinPart=true
StripMarkdown=true |
Just FYI, I'm still getting duplicate messages. But no time how to debug this ATM. |
Your fix seems to work for me as well @voegelas. You should submit it as a PR. :) |
Clear IRC event handlers that we will be registering for the new connection before registering new handlers. This prevents duplicate event handlers in the case where we are connecting via a BNC and are seeing a reconnect. Attempting to clear handlers when none have been set is a no-op. Fixes 42wim#1564 Co-authored-by: Andreas Vögele <andreas@andreasvoegele.com>
…#2138) Clear IRC event handlers that we will be registering for the new connection before registering new handlers. This prevents duplicate event handlers in the case where we are connecting via a BNC and are seeing a reconnect. Attempting to clear handlers when none have been set is a no-op. Fixes #1564 Co-authored-by: Andreas Vögele <andreas@andreasvoegele.com>
Describe the bug
I'm bridging IRC channels on a ZNC bouncer to Telegram groups. After some days messages appear duplicated in all Telegram groups. It stays that way until I restart matterbridge. This has been an issue since forever, it isn't a recent bug. But I feel like it now appears sooner after a restart than before.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Duplicate messages don't appear.
Screenshots/debug logs
On July the 24th I had a first: Triple messages!
Some non-debug logs, not sure if related: https://fb.hash.works/vCj4AZ/
Since the issue only appears after a while I haven't gathered debug logs yet, could do so on request. Might take a while.
Environment:
Additional context
Relevant config sections: https://fb.hash.works/K7OTbRjt/
The text was updated successfully, but these errors were encountered: