Bug 3809 - Loading gpg related plugin causes freezing
Summary: Loading gpg related plugin causes freezing
Status: RESOLVED INVALID
Alias: None
Product: Claws Mail
Classification: Unclassified
Component: Plugins/Privacy/PGP (show other bugs)
Version: 3.13.2
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2017-04-15 15:36 CEST by nosp
Modified: 2017-04-16 12:48 CEST (History)
0 users

See Also:


Attachments
Output of "gdb claws-mail" (12.78 KB, text/plain)
2017-04-15 15:36 CEST, nosp
no flags Details
gdb backtrace (24.79 KB, text/plain)
2017-04-15 21:03 CEST, nosp
no flags Details
backtrace after deleting existing keys (24.14 KB, text/plain)
2017-04-16 00:54 CEST, nosp
no flags Details
backtrace after creating new key (24.44 KB, text/plain)
2017-04-16 00:54 CEST, nosp
no flags Details
Output of gdb claws-mail after modifying .bashrc (14.43 KB, text/plain)
2017-04-16 11:49 CEST, nosp
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description nosp 2017-04-15 15:36:04 CEST
Created attachment 1741 [details]
Output of "gdb claws-mail"

Loading any of these plugins

pgpcore.so
pgpinline.so
pgpmime.so

via Configuration->Plugins...->Load...

causes Claws Mail to freeze.
I attached output of gdb.

OS: Xubuntu 16.04.2
Installed with:
sudo apt-get install claws-mail claws-mail-plugins claws-mail-extra-plugins claws-mail-pgpinline claws-mail-pgpmime claws-mail-fancy-plugin claws-mail-smime-plugin claws-mail-dbg
Comment 1 Andrej Kacian 2017-04-15 20:12:21 CEST
What happens when Claws Mail is frozen? Is one (or perhaps more) CPU core at 100%?

Can you please, instead of "externally killing" the process, let it run, hit CTRL+c in the console where gdb is running, and get a backtrace ('thread apply all bt full' command)?
Comment 2 nosp 2017-04-15 21:03:44 CEST
Created attachment 1742 [details]
gdb backtrace

Output of:

gdb claws-mail
run --debug
thread apply all bt full
Comment 3 nosp 2017-04-15 21:10:05 CEST
CPUs are idle during Claws Mail is frozen. Memory consumption does not change and is low.
Comment 4 Andrej Kacian 2017-04-15 23:40:33 CEST
I am stumped. The freeze obviously happens while Claws Mail is trying to figure out whether you have some secret keys in your keyring - both PGP and S/MIME - but I have no idea why it would just stop.

Do these commands finish OK and do they list something out of the ordinary?
gpg --list-secret-keys
gpgsm --list-secret-keys
Comment 5 Michael Rasmussen 2017-04-16 00:51:52 CEST
It could also be related to some malfunctioning gpg agent. To me it looks as the problem I once had where the agent failed to call the pineentry program and therefore communicated with stdout. If I recall I wrote the proper solution on this bug tracker somewhere.
Comment 6 nosp 2017-04-16 00:53:40 CEST
I ran both commands:
gpg --list-secret-keys

Lists the key I imported the other day. 

gpgsm --list-secret-keys

No output at all.


I deleted the key and tried again to load the plugins. Same behavior as far as I understand. See attachment gdb_backtrace_no_keys.

I created another key and tried again, same result. See attachment gdb_backtrace_new_key.
Comment 7 nosp 2017-04-16 00:54:25 CEST
Created attachment 1743 [details]
backtrace after deleting existing keys
Comment 8 nosp 2017-04-16 00:54:56 CEST
Created attachment 1744 [details]
backtrace after creating new key
Comment 9 Michael Rasmussen 2017-04-16 01:08:40 CEST
What output does the following give:
dpkg --get-selections |grep pinentry
env |grep -i tty
Comment 10 nosp 2017-04-16 09:41:42 CEST
:~$ dpkg --get-selections |grep pinentry
pinentry-gnome3					install
pinentry-gtk2					install
:~$ env |grep -i tty
:~$ 
(not output for env |grep -i tty)
Comment 11 Michael Rasmussen 2017-04-16 11:18:31 CEST
Try adding this to ~/.bashrc
# Set GPG TTY
export GPG_TTY=/dev/pts/1

Sometimes below is also necessary but try above first:
#$(tty)
# Refresh gpg-agent tty in case user switches into an X session
gpg-connect-agent updatestartuptty /bye >/dev/null
Comment 12 nosp 2017-04-16 11:49:54 CEST
Created attachment 1745 [details]
Output of gdb claws-mail after modifying .bashrc

Added
export GPG_TTY=/dev/pts/1 
to .bashrc.
gdb claws-mail
run --debug

Loading plugins worked as expected.
Comment 13 nosp 2017-04-16 11:52:23 CEST
After adding export GPG_TTY=/dev/pts/1 to .bashrc, the plugin loaded successfully.
Thanks!

Anything else I can do to help fix/avoid this for others?
Comment 14 Paul 2017-04-16 11:54:16 CEST
It's a Xubuntu 16.04.2 bug, gpg-agent not getting set up correctly. You can report it to them.
Comment 15 nosp 2017-04-16 11:57:14 CEST
Will do, thanks again.
Comment 16 Andrej Kacian 2017-04-16 12:17:52 CEST
(In reply to comment #13)
> After adding export GPG_TTY=/dev/pts/1 to .bashrc, the plugin loaded
> successfully.
> Thanks!
> 
> Anything else I can do to help fix/avoid this for others?

What if your TTY is different next time you log in? I don't think it always has to be /dev/pts/1.
Comment 17 Paul 2017-04-16 12:21:26 CEST
(In reply to comment #16)
> (In reply to comment #13)
> > After adding export GPG_TTY=/dev/pts/1 to .bashrc, the plugin loaded
> > successfully.
> > Thanks!
> > 
> > Anything else I can do to help fix/avoid this for others?
> 
> What if your TTY is different next time you log in? I don't think it always
> has to be /dev/pts/1.

Yes, what you want is this:

export GPG_TTY=`tty`

Re: https://www.gnupg.org/documentation/manuals/gnupg/Common-Problems.html
Comment 18 Michael Rasmussen 2017-04-16 12:48:52 CEST
I have done some testing. It seems to be of no importance what value the GPG_TTY environment variable has as long as it is set. Maybe of importance for the curses based pinentry but seems irrelevant to the gtk or gnome based pinentry so it could be a bug in gpg-agent?