42wim/matterircd

Issues with messages (including a crash)

Closed this issue · 12 comments

Hi @42wim, I see you are actively refactoring the code, thanks for that firstly! It's glad to see this great project getting improved =)

So, this issue is a mix of some small issues (and a crash) I'm seeing when dealing with mattermost messages using matterircd; I suspect/feel that all of those have the same root cause, so I'll list the issues and my reasoning about them:

  1. If I go to the webclient and send a message to myself, matterircd crashes...after it's back (i.e., when I restart matterircd), the message is replayed back to me as coming from "mattermost" user!

  2. If I'm talking with my colleague Mr. X in matterircd, through messages, and go to web-client to send him a message (like a code or something), it shows in matterircd as coming from myself, even the channel/window of my conversation with Mr. X being opened in my IRC client.

  3. If we’re on a message/conversation “channel” on IRC and the mattermost user edits a message, irc-user does not receive the (edited) message (though in a regular channel it works).

So, specially for (1) and (2), it seems there's a kind of "indirection" on how matterircd handles messages. If I send a message to some user in web client matterircd handles that as a message to myself. If I indeed send a message to myself, it crashes - it's a like a dereference that got NIL due to this indirection!

I'm not sure if (3) is related or not, but I guess worth the report. Thanks again for the great piece of software =)

42wim commented

@guilhermepiccoli are those reports based on current master? because a lot of those should be fixed in master.

That's great news @42wim , thank you! I'm not running master from today (I guess my build was like 10 days ago). I will rebuild now and start to test, thanks!

42wim commented

master contains the refactor and fixes, also be sure to read the changelog.md some things have changed

Issues (1) and (2) still exist.

Issue (3) seems to be fixed! Thanks.

But I've noticed something odd; I've sent a message to a friend and he didn't got (didn't show in the web client). Then I've sent a test message in the web client and the message that didn't go before, went with my test, as if it was "stuck" in a buffer or anything like that. After this event, it seems I'm being able to use the messages again, normally...

42wim commented

If I'm talking with my colleague Mr. X in matterircd, through messages, and go to web-client to send him a message (like a code or something), it shows in matterircd as coming from myself, even the channel/window of my conversation with Mr. X being opened in my IRC client.

That's normal because it is coming from yourself?

If I'm talking with my colleague Mr. X in matterircd, through messages, and go to web-client to send him a message (like a code or something), it shows in matterircd as coming from myself, even the channel/window of my conversation with Mr. X being opened in my IRC client.

That's normal because it is coming from yourself?

Hmm..not sure! Imagine I'm talking with mr. X in IRC, so there's a channel/window open with our talk. I assume this channel has an id or something like that...that's the way the channel was created in the first message between me and mr. X. Then I go on web client for some reason and send like a code...it opens a different window on IRC, like the message was from me, to me! It completely messes the logs and whatnot, I feel it should dump that message in the same channel/window I was talking with mr. X, right?

42wim commented

oh no, that's not correct, it should dump it in the same window as your chat with mr X.. I thought this was fixed.
what irc client are you using and what mattermost version?

Thank you @42wim =)
I'm using matterircd from today's master, znc connected to it and hexchat connected to ZNC.

Checking company's "about mattermost" , I see the following info:

Mattermost Version: 5.23.1
Database Schema Version: 5.23.0
Database: postgres

42wim commented

could you try with irssi+matterircd? just to be sure that's not your client (I can't test right now)

Very interesting, testing with weechat+matterircd directly, issue (2) seems to be solved. But issue (1) the crash is reproducible.

This is the backtrace from issue (1):

DEBU[0535] MMUser WsReceiver: &model.WebSocketEvent{Event:"posted", Data:map[string]interface {}{"channel_display_name":"@gpiccoli", "channel_name":"hz8pyxhqup83dn939ogjx1yufh__hz8pyxhqup83dn939ogjx1yufh", "channel_type":"D", "post":"{"id":"qnixf6db1fyobb8wtikzf6wkfo","create_at":1597182513845,"update_at":1597182513845,"edit_at":0,"delete_at":0,"is_pinned":false,"user_id":"hz8pyxhqup83dn939ogjx1yufh","channel_id":"fhu9myrpktbj8c874zuu65bewe","root_id":"","parent_id":"","original_id":"","message":"whohoo","type":"","props":{"disable_group_highlight":true},"hashtags":"","pending_post_id":"hz8pyxhqup83dn939ogjx1yufh:1597182513726","reply_count":0,"metadata":{}}", "sender_name":"@gpiccoli", "team_id":""}, Broadcast:(*model.WebsocketBroadcast)(0xc0008222c0), Sequence:0, precomputedJSON:(*model.precomputedWebSocketEventJSON)(nil)}
DEBU[0535] handleWsActionPost() receiving userid hz8pyxhqup83dn939ogjx1yufh
panic: interface conversion: interface {} is nil, not string

goroutine 146 [running]:
github.com/42wim/matterircd/bridge/mattermost.(*Mattermost).handleWsActionPost(0xc000169f10, 0xc000917290)
/home/guilherme/src/matterircd/bridge/mattermost/mattermost.go:651 +0x1f6b
github.com/42wim/matterircd/bridge/mattermost.(*Mattermost).handleWsMessage(0xc000169f10)
/home/guilherme/src/matterircd/bridge/mattermost/mattermost.go:121 +0x2ff
created by github.com/42wim/matterircd/bridge/mattermost.(*Mattermost).loginToMattermost
/home/guilherme/src/matterircd/bridge/mattermost/mattermost.go:87 +0x311

42wim commented

Issue 1 is now fixed too in master, as are probably other weird DM issues

Thanks, tested and indeed it's fixed! Appreciate your promptness =)