mautrix / meta

A Matrix-Facebook Messenger and Instagram DM puppeting bridge.
GNU Affero General Public License v3.0
155 stars 11 forks source link

getClientPayload() SIGSEGV #49

Closed sxvghd closed 3 months ago

sxvghd commented 5 months ago

I've been using the FB Messenger integration here for a bit, but I've started to encounter a pesky crash. So the following chain of events has been happening to me since last week at least once per few days:

  1. My session times out or something, messages don't get sent and bridge responds with "Your message may not have been bridged: failed to send LS request: not connected"
  2. I delete my session, login into FB from browser, get the cURL and dump it for the bridge
  3. It takes a while to process, but after a while returns info that I'm logged in
  4. Nothing works and then I find out that the process has crashed.

Relevant logs:

2024-04-12T13:43:17+02:00 DBG Initial connect to Meta socket completed user_id=xxx
2024-04-12T13:43:17+02:00 DBG Sending cached initial table to handler user_id=xx
2024-04-12T13:43:17+02:00 DBG Dialing wss://web-chat-e2ee.facebook.com/ws/chat component=whatsmeow sublogger=Socket user_id=xxx
2024-04-12T13:43:17+02:00 DBG Got media response, reading data action="handle table" content_length=3732 function=Puppet.UpdateInfo user_id=xxx
2024-04-12T13:43:17+02:00 DBG Media download complete action="handle table" data_length=3732 function=Puppet.UpdateInfo user_id=xxxx
2024-04-12T13:43:18+02:00 DBG Frame websocket read pump starting 0xc0009764e0 component=whatsmeow sublogger=Socket user_id=xxxxx
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x14d4050]

goroutine 20175 [running]:
go.mau.fi/mautrix-meta/messagix.(*Client).getClientPayload(0xc000c7c500)
        /var/synapse_addons/mautrix-meta/messagix/e2ee-client.go:108 +0x30
go.mau.fi/whatsmeow.(*Client).doHandshake(0xc000ac6000, 0xc0009764e0, {0xc00071e4c0?, 0xc00071e480?})
        /var/synapse/go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240326141755-051606b388f6/handshake.go:95 +0xadd
go.mau.fi/whatsmeow.(*Client).Connect(0xc000ac6000)
        /var/synapse/go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240326141755-051606b388f6/client.go:354 +0x74c
main.(*User).connectE2EE(0xc0002d2280)
        /var/synapse_addons/mautrix-meta/user.go:934 +0x89a
main.(*User).eventHandler.func2()
        /var/synapse_addons/mautrix-meta/user.go:1095 +0x1c
created by main.(*User).eventHandler in goroutine 20179
        /var/synapse_addons/mautrix-meta/user.go:1094 +0x41b

Bridge itself is compiled from master branch, commit 95b86151f3dca4caf559633c7456c0299d1e4c40.

sxvghd commented 3 months ago

I have not encountered the bug ever since reporting it. Closing for now.