Skip to content

Zulip messages take 10s to send #2237

@kousu

Description

@kousu

Describe the bug
#1869 has reappeared. When bridging Zulip, messages received from it do not send for 10s.

To Reproduce

  1. Run matterbridge with a Zulip bridge + gateway that uses it
  2. Send a message in Zulip, wait 10s for it to appear on recipient sides
  3. Send a message from the other sides; see it appear immediately in Zulip

Expected behavior
Bridge the messages immediately.

Screenshots/debug logs

This message from Zulip

Image

doesn't show up for 10s in Converse.js:

Image
root@zulip:~# matterbridge -debug -conf /etc/matterbridge/org.toml 
[0000]  INFO main:         [setupLogger:matterbridge.go:104] Enabling debug logging.
[0000]  INFO main:         [main:matterbridge.go:44] Running version 1.26.0 6dafebc7
[0000]  INFO router:       [Start:gateway/router.go:66] Parsing gateway gateway1
[0000]  INFO router:       [Start:gateway/router.go:75] Starting bridge: xmpp.bridge 
[0000]  INFO xmpp:         [Connect:bridge/xmpp/xmpp.go:45] Connecting example.org:5222
[0000]  INFO xmpp:         [Connect:bridge/xmpp/xmpp.go:51] Connection succeeded
[0000]  INFO xmpp:         [joinChannels:bridge/bridge.go:77] xmpp.bridge: joining general (ID: generalxmpp.bridge)
[0000]  INFO router:       [Start:gateway/router.go:75] Starting bridge: zulip.bridge 
[0000] DEBUG xmpp:         [handleXMPP:bridge/xmpp/xmpp.go:298] == Receiving xmpp.Chat{Remote:"[email protected]/kousu_", Type:"groupchat", Text:"", Subject:"org e/n", Thread:"", Ooburl:"", Oobdesc:"", ID:"", ReplaceID:"", Roster:xmpp.Roster(nil), Other:[]string{}, OtherElem:[]xmpp.XMLElement(nil), Stamp:time.Date(2025, time.July, 29, 14, 11, 43, 0, time.UTC)}
[0000]  INFO zulip:        [Connect:bridge/zulip/zulip.go:43] Connection succeeded
[0000]  INFO zulip:        [joinChannels:bridge/bridge.go:77] zulip.bridge: joining Zulip/topic:general (ID: Zulip/topic:generalzulip.bridge)
[0000]  INFO main:         [main:matterbridge.go:68] Gateway(s) started succesfully. Now relaying messages
[0011] DEBUG zulip:        [handleQueue:bridge/zulip/zulip.go:129] receiving error: <nil>
[0021] DEBUG zulip:        [handleQueue:bridge/zulip/zulip.go:136] == Receiving gozulipbot.EventMessage{AvatarURL:"/user_avatars/2/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.png", Client:"website", Content:"z->x", ContentType:"text/x-markdown", DisplayRecipient:gozulipbot.DisplayRecipient{Users:[]gozulipbot.User(nil), Topic:"Zulip"}, GravatarHash:"", ID:58, RecipientID:8, SenderDomain:"", SenderEmail:"[email protected]", SenderFullName:"kousu", SenderID:9, SenderShortName:"", Subject:"general", SubjectLinks:[]interface {}(nil), StreamID:1, Timestamp:1754212878, Type:"stream", Queue:(*gozulipbot.Queue)(0xc0007b0000)}
[0021] DEBUG zulip:        [handleQueue:bridge/zulip/zulip.go:155] <= Sending message from kousu on zulip.bridge to gateway
[0021] DEBUG zulip:        [handleQueue:bridge/zulip/zulip.go:156] <= Message is config.Message{Text:"z->x", Channel:"Zulip/topic:general", Username:"kousu", UserID:"9", Avatar:"https://zulip.example.org/user_avatars/2/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.png", Account:"zulip.bridge", Event:"", Protocol:"", Gateway:"", ParentID:"", Timestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), ID:"", Extra:map[string][]interface {}(nil)}
[0021] DEBUG gateway:      [SendMessage:gateway/gateway.go:499] => Sending config.Message{Text:"z->x", Channel:"Zulip/topic:general", Username:"kousu", UserID:"9", Avatar:"https://zulip.example.org/user_avatars/2/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.png", Account:"zulip.bridge", Event:"", Protocol:"zulip", Gateway:"gateway1", ParentID:"", Timestamp:time.Date(2025, time.August, 3, 5, 21, 28, 483280508, time.Local), ID:"", Extra:map[string][]interface {}(nil)} from zulip.bridge (Zulip/topic:general) to xmpp.bridge (general)
[0021] DEBUG xmpp:         [Send:bridge/xmpp/xmpp.go:80] => Receiving config.Message{Text:"z->x", Channel:"general", Username:"<kousu> ", UserID:"9", Avatar:"https://zulip.example.org/user_avatars/2/xxxxxxxxxxxxxxxxxxxxxxxxxxx.png", Account:"zulip.bridge", Event:"", Protocol:"zulip", Gateway:"gateway1", ParentID:"", Timestamp:time.Date(2025, time.August, 3, 5, 21, 28, 483280508, time.Local), ID:"", Extra:map[string][]interface {}(nil)}
[0021] DEBUG xmpp:         [Send:bridge/xmpp/xmpp.go:133] => Sending message config.Message{Text:"z->x", Channel:"general", Username:"<kousu> ", UserID:"9", Avatar:"https://zulip.example.org/user_avatars/2/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.png", Account:"zulip.bridge", Event:"", Protocol:"zulip", Gateway:"gateway1", ParentID:"", Timestamp:time.Date(2025, time.August, 3, 5, 21, 28, 483280508, time.Local), ID:"", Extra:map[string][]interface {}(nil)}
[0021] DEBUG gateway:      [SendMessage:gateway/gateway.go:518] mID xmpp.bridge: d27ik66ibc42qdh4k360
[0021] DEBUG gateway:      [func1:gateway/gateway.go:508] => Send from zulip.bridge (Zulip/topic:general) to xmpp.bridge (general) took 1.038262ms
[0021] DEBUG xmpp:         [handleXMPP:bridge/xmpp/xmpp.go:298] == Receiving xmpp.Chat{Remote:"[email protected]/bridge", Type:"groupchat", Text:"<kousu> z->x", Subject:"", Thread:"", Ooburl:"", Oobdesc:"", ID:"d27ik66ibc42qdh4k360", ReplaceID:"", Roster:xmpp.Roster(nil), Other:[]string{"", ""}, OtherElem:[]xmpp.XMLElement{xmpp.XMLElement{XMLName:xml.Name{Space:"urn:xmpp:occupant-id:0", Local:"occupant-id"}, InnerXML:""}, xmpp.XMLElement{XMLName:xml.Name{Space:"urn:xmpp:sid:0", Local:"stanza-id"}, InnerXML:""}}, Stamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)}

[0011] DEBUG zulip: [handleQueue:bridge/zulip/zulip.go:129] receiving error:

happens immediately when I send a message in Zulip, but then there's no output for a moment while we hold our breath.

It's weird, #2024 wrapped the relevant code

default:
b.Log.Debugf("receiving error: %#v", err)
time.Sleep(time.Second * 10)

in

if err != nil {

so I'm not sure how an err = nil is slipping through. Is <nil> not the same as nil?

Environment (please complete the following information):

  • OS: Debian Bookworm
  • Matterbridge version: 1.26.0 6dafebc
  • Zulip 5.1.10

Additional context

[xmpp]
[xmpp.bridge]
Server="example.org:5222"
Jid="[email protected]"
Password="xxxxxxxxxxxxxxxxx"
Muc="converse.example.org"
Nick="bridge"
RemoteNickFormat="<{NICK}> "

[zulip]
[zulip.bridge]
Token="xxxxxxxxxxxxxxxxxxxxxxx"
Login="[email protected]"
Server="https://zulip.example.org"
RemoteNickFormat="<{NICK}> "

[[gateway]]
name="gateway1"
enable=true

[[gateway.inout]]
account="xmpp.bridge"
channel="general"

[[gateway.inout]]
account="zulip.bridge"
channel="Zulip/topic:general"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions