Profanity in compose-mode get disconnected
debug-profanity.log profrc-profanity.txt
Description of the issue
When using the compose editor during few minutes, Profanity display an error message. It says the connection has been lost.
It happens with any program used as editor (tested on nano + emacs-nox). It happens in 1-1 chat and in chatrooms. It is not depending on message-length.
Version
profanity 0.14.0
libstrophe 0.12.3
glib 2.76.4
$ profanity -v
Profanity, version 0.14.0
Copyright (C) 2012 - 2019 James Booth <[email protected]>.
Copyright (C) 2019 - 2023 Michael Vetter <[email protected]>.
License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Build information:
XMPP library: libstrophe
Desktop notification support: Enabled
OTR support: Enabled (libotr 4.1.1)
PGP support: Enabled (libgpgme 1.17.1)
OMEMO support: Enabled
C plugins: Enabled
Python plugins: Enabled (3.11.4)
GTK icons/clipboard: Disabled
GDK Pixbuf: Enabled
How to reproduce
-
Launch Profanity, then start a discussion in 1-1 chat
-
launch editor (M-c or /editor) then wait 4min. Do not wait 5sec
-
type your message in editor
-
save/exit the editor : "Lost connection - Reconnecting" appears in the chat window.
The facts
The reconnection depends on settings in profrc file. In my profrc, Profanity will reconnect immediatly, but that is not the default configuration. For some users, there might be a delay or no reconnection at all.
The "Lost connection" message is not really true, because the XMPP account is never shown as "offline" in rosters of my contacts (after 4min).
You are able to send the message right-after compose. No message is lost.
(The XMPP account used to produce the logs is a test account).
Thats to be expected. Since during that time we dont send pings.
Thats to be expected. Since during that time we dont send pings.
I want to add some details.
It can be fixed by calling /editor asynchronously, while keeping profanity running on background. I made some minor attempt and didn't succeed at this (we need to make other program in focus and then capture its output once user exits it).
It can be renamed to something like:
Fix: make /editor asynchronous
We had a whole discussion and PR around this subject: https://github.com/profanity-im/profanity/issues/1805 https://github.com/profanity-im/profanity/pull/1806. It got not closed because of the proposal but because of the person involved was impolite and annoying to several people in our community.
We had a whole discussion and PR around this subject: #1805 #1806. It got not closed because of the proposal but because of the person involved was impolite and annoying to several people in our community.
Well, it does not fix the issue, we have to read the edited file once the editor is closed. It probably would make sense to a bit rework forking part (we can waitpid there and then paste the result, something like async paradigm).
fork:
1st part:
start /editor
wait for it to finish
call on_editor_finish_remove_file_and_paste_to_readline()
ui_resize etc.
2nd part: continue execution as normal to prevent connectivity issues.
Also we should ideally keep all this time composing state
UPD: the actual problem is that profanity keeps redrawing (and probably listening to the input), so we somehow need to stop redrawing, but to continue listening network. I don't see really good way to get it done easily...