xfce4-session will start gpg-agent, but it will not stop it at logout. On the next login of the same user, xfce4-session will check to see if gpg-agent is already running (which it will be) and not start another instance. The problem is that if the user is using gpg-agent's SSH agent support, SSH_AUTH_SOCK will not get incorporated into the environment on the second login. This is because xfce4-session doesn't start gpg-agent on the second login, so it doesn't have this information. To solve this, xfce4-session must stop gpg-agent on logout if xfce4-session starts gpg-agent on login. This is all with either enable-ssh-support in .gnupg/gpg-agent.conf, or with xfconf settings xfce4-session:/startup/ssh-agent/enabled = True and xfce4-session:/startup/ssh-agent/type = gpg-agent set.
I can't reproduce this with xfce4-session-4.12.1. PID of gpg-agent is stored at session start and gpg-agent is stopped at logout. Are you sure that gpg-agent is started by xfce4-session? If not, then xfce4-session will not stop it at logout, of course.
There was a minor release since then, so maybe it was fixed? I am pretty sure it was xfce4 that started it, since when I change the ssh agent to openssh ssh-agent, gpg-agent is not started. I'll try it again...
The problem is worse than I thought. xfce4-session loses track of a whole array of processes: eric 414 0.5 0.0 36920 3832 ? Ss 02:07 0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation eric 418 0.2 0.1 54660 5048 ? S 02:07 0:00 /usr/lib/xfce4/xfconf/xfconfd eric 421 0.0 0.0 17628 252 ? Ss 02:07 0:00 /usr/bin/gpg-agent --sh --daemon --write-env-file /home/eric/.cache/gpg-agent-info root 443 0.3 0.2 233876 9024 ? Ssl 02:07 0:00 /usr/lib/upower/upowerd eric 454 0.0 0.2 275128 8128 ? Ssl 02:07 0:00 /usr/lib/gvfs/gvfsd eric 466 0.0 0.1 406476 5548 ? Sl 02:07 0:00 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes eric 471 0.2 0.3 347732 12888 ? SNl 02:07 0:00 /usr/lib/tumbler-1/tumblerd eric 472 0.0 0.1 335316 6576 ? Sl 02:07 0:00 /usr/lib/at-spi2-core/at-spi-bus-launcher eric 489 0.0 0.0 36676 3488 ? S 02:07 0:00 /usr/bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3 eric 494 0.0 0.1 216056 5168 ? Sl 02:07 0:00 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session eric 501 0.1 0.2 309120 8436 ? Ssl 02:07 0:00 /usr/lib/gvfs/gvfs-udisks2-volume-monitor root 504 0.7 0.1 365064 7200 ? Ssl 02:07 0:00 /usr/lib/udisks2/udisksd --no-debug eric 521 0.0 0.1 351264 6396 ? Sl 02:07 0:00 /usr/lib/gvfs/gvfsd-trash --spawner :1.13 /org/gtk/gvfs/exec_spaw/0 eric 526 0.0 0.1 191728 5528 ? Ssl 02:07 0:00 /usr/lib/gvfs/gvfsd-metadata To get this, I did a ps aux, logged into XFCE, logged out, then did another ps aux. All of the above processes weren't shut down.
BTW that happens with startx and slim. xfce4 is started from .xinitrc with the following line: exec ssh-agent startxfce4
The patch attached to bug 12044 should also fix dangling gpg-agent and ssh-agent processes.
I confirm, the gpg-agent thing is fixed by bug #12044 But the problem of other process not terminated on logout is still here (maybe restart user bus on logout like gnome) *** This bug has been marked as a duplicate of bug 12044 ***