Bug 3809 - Loading gpg related plugin causes freezing
Summary: Loading gpg related plugin causes freezing
Status: RESOLVED INVALID
Alias: None
Product: Claws Mail (GTK 2)
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 UTC by nosp
Modified: 2017-04-16 12:48 UTC (History)
0 users

See Also:


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

Description nosp 2017-04-15 15:36:04 UTC
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 UTC
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 UTC
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 UTC
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 UTC
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 UTC
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 UTC
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 UTC
Created attachment 1743 [details]
backtrace after deleting existing keys
Comment 8 nosp 2017-04-16 00:54:56 UTC
Created attachment 1744 [details]
backtrace after creating new key
Comment 9 Michael Rasmussen 2017-04-16 01:08:40 UTC
What output does the following give:
dpkg --get-selections |grep pinentry
env |grep -i tty
Comment 10 nosp 2017-04-16 09:41:42 UTC
:~$ 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 UTC
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 UTC
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 UTC
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 UTC
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 UTC
Will do, thanks again.
Comment 16 Andrej Kacian 2017-04-16 12:17:52 UTC
(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 UTC
(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 UTC
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?

Note You need to log in before you can comment on or make changes to this bug.