Bug 386647 - After resuming from standby & reconnect, ktp-text-ui chat window and chat-plasmoid open
Summary: After resuming from standby & reconnect, ktp-text-ui chat window and chat-pla...
Status: CONFIRMED
Alias: None
Product: telepathy
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: Future
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-08 13:21 UTC by t.schmittlauch
Modified: 2017-11-10 15:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
log of MissionControl during standby and resume, while problem appears (224.73 KB, text/plain)
2017-11-08 13:21 UTC, t.schmittlauch
Details
log of Gabble while bug appears (23.36 KB, text/plain)
2017-11-08 13:22 UTC, t.schmittlauch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description t.schmittlauch 2017-11-08 13:21:26 UTC
Created attachment 108743 [details]
log of MissionControl during standby and resume, while problem appears

After resuming from standby, a conversation with a contact from quick chat in the chat plasmoid and the ktp-text-ui chat window are opened in foreground and suddenly catch both users keyboard input and attention.
This happens reproducably when resuming from standby as soon as my laptop has reconnected to wifi, but sometimes also happens when just changing/ re-establishing the internet connection or changing ones online status from offline to online again.
So there's probably something wrong with handling the connection state change.

I can provide logs from MissionControl and from Gabble, both aquired through ktp-debugger

version: 17.08.2 on gentoo
Comment 1 t.schmittlauch 2017-11-08 13:22:16 UTC
Created attachment 108744 [details]
log of Gabble while bug appears
Comment 2 t.schmittlauch 2017-11-08 18:46:44 UTC
I also captured a DBus log during the problem using bustle, but as I don't know whether that log may contain sensitive data I won't publish it here so far.
If you can help me with debugging, just contact me.
Comment 3 Alexandr Akulich 2017-11-10 15:33:58 UTC
The Bustle log shows that there are requests to ChannelDispatcher to EnsureChannel with a preferred handler = TpQtRaH Telepathy client. The first request wakes up CM, but at the time of TextChannel appearance, there is no TpQtRaH client anymore, so the ChannelDispatcher decides to raise a default handler, namely — ktp-text-ui.

After a discussion, it turns out that the TpQtRaH clients registered by the Chat Plasmoid and the C++ place of registration is TelepathyQt PendingChannel [1].

I think of the following options:
1) Change TpQt API to let the Chat Plasmoid to specify the PendingChannel handler service name as the name of the plasmoid.
2) Change TpQt or Chat Plasmoid to "ask the ChannelDispatcher to wake up a ConnectionManager and then ask the ConnectionManager directly to restore the channel". In this way, we'll use [2] with your=true to suppress an automatic handler invocation. Right now we use [3] with preferredHandler = <a unique client service name for every PendingChannel>.
2) Disable the offline account PendingChannel-related code in the Chat Plasmoid. I have no idea how it will affect the Plasmoid functionality, but maybe it does not make much sense to ask ChannelDispatcher to set some account presence (to online).

[1] https://github.com/TelepathyIM/telepathy-qt/blob/master/TelepathyQt/pending-channel.cpp#L193
[2] https://telepathy.freedesktop.org/spec/Channel_Dispatcher.html#Method:EnsureChannel
[3] https://telepathy.freedesktop.org/spec/Connection_Interface_Requests.html#Method:EnsureChannel