! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Segfault when trying to logout/shutdown through the logout dialog
Status:
CLOSED: FIXED
Product:
Xfce4-session
Component:
General

Comments

Description Thomas Lange 2014-11-16 15:02:27 CET
The attempt to logout/shutdown through the logout dialog ("xfce4-session-logout")
always leads to a segfault. Shutting down the machine graphically is hence not possible.

dmesg:
Nov 16 14:40:31 arch kernel: xfce4-session[314]: segfault at 8 ip 00000000004136d2 sp 00007fff4a3d40f0 error 4 in xfce4-session[400000+28000]

Tested versions:
xfce4-session 4.10.1
xfce4-session-git (latest)

System:
Arch Linux with systemd

Do you need more information? Which log files could be useful?
Comment 1 Steve Dodier-Lazaro editbugs 2014-11-16 23:01:57 CET
Hi Thomas,

I've never heard of a session segfault like this so bear with me, I'm not sure exactly where to get the right information. I assume you segfault when clicking on Logout or on Shutdown, but that just opening the dialog is ok and just clicking Suspend is ok. Tell me if I'm wrong.

First, it'd be good to have an exact idea of what hardware you run, and what services are running on your machine. Could you please tell us about your hardware (attach the output of 'lshw')? We also need to know if you're on amd64 or x86 so we can replicate the libraries and dependencies on your system. As you're on ArchLinux and it's a rolling distro it won't be so easy, so it'd be great to inform us when exactly you last updated.

We might also want to know what programs your session needs to talk to when shutting down. Do you have session saving enabled?, the programs in your xfce4 session (attach the contents of files named ~/.config/sessions/xfce4-session*), and your autostart apps (attach all the files in ~/.config/autostart/).

I'm asking you for this just to find if specific conditions trigger this bug. It's unlikely that this information alone tells us what's going on and we'll really need one of the people who know Xfce4-session to comment and tell what exactly could cause such a crash.

If you know how to build Arch packages, it would help a lot to build a debug version of Xfce4-session, and then ensure that your system will produce a core dump when it crashes (look up here for instructions: http://stackoverflow.com/questions/17965/generate-a-core-dump-in-linux).

With the core dump, we're a bit more able to investigate. You can either replay it yourself in gdb (see http://stackoverflow.com/questions/5115613/core-dump-file-analysis) or attach it and wait for another Arch user to look it up.

What we're interested in is the exact code line in xfce4-session where the crash occurs.
Comment 2 Thomas Lange 2014-11-17 10:09:57 CET
Hi Steve,

thanks for your detailed answer.

You are right that opening the dialog works fine and clicking
logout/shutdown leads to the segfault.

Your question about sessions reminded me that I have set
"~/.config/sessions/" as readonly (chmod 400) to workaround
the common session restore bug.
I want XFCE always to start in a clean session.

There are dozens of threads like this:
https://forum.xfce.org/viewtopic.php?id=8082

After removing the folder so it is recreated segfaults are not
occurring anymore.

Should XFCE check if it can write to this folder to prevent the crash?
Comment 3 Steve Dodier-Lazaro editbugs 2014-11-18 09:46:47 CET
Hi Thomas,

Thanks, I've bumped the developers about the patch waiting for review on bug 7930.

I've had a look at the Xfce4 session code and it seems to be doing things properly. The bug is probably in an underlying Xfce library that takes care of configuration files.

To the developers:

xfsm_manager_store_session contains the following code, so if the behaviour reported by Thomas can be confirmed/reproduced the bug is likely in xfce_rc_simple_open (or I've missed the relevant code path):

  rc = xfce_rc_simple_open (manager->session_file, FALSE);
  if (G_UNLIKELY (rc == NULL))
    {
      fprintf (stderr,
               "xfce4-session: Unable to open session file %s for "
               "writing. Session data will not be stored. Please check "
               "your installation.\n",
               manager->session_file);
      return;
    }
Comment 4 Eric Koegel editbugs 2014-12-07 09:41:33 CET
Created attachment 5808 
Check that we can write to the file before we do

Can you try out this patch? If it's good I'll add it and then look at fixing xfce_rc_simple_open as well (I'm not sure if changing that will break other uses of it so I wanted to start with the smallest fix first).
Comment 5 Thomas Lange 2014-12-07 14:56:22 CET
Thanks for the patch. I applied it to 4.10.1 but the segfault still occurs.

Dez 07 14:49:45 arch kernel: xfce4-session[1602]: segfault at 8 ip 0000000000413335 sp 00007fff67f3b520 error 4 in xfce4-session[400000+27000]
Comment 6 Thomas Lange 2014-12-07 15:03:31 CET
Steps to reproduce:

1. Logout from your XFCE session
2. Delete all XFCE related files/dirs in ~/.cache/sessions
3. chmod 400 ~/.cache/sessions
4. Run "xfce4-session-logout" and click "Logout"

$ ls -l ~/.cache
dr-------- 3 thomas users 4,0K  7. Dez 14:44 sessions
Comment 7 Eric Koegel editbugs 2014-12-08 13:43:51 CET
Created attachment 5810 
Gracefully handle the sessions dir being readonly

Ah, there's a couple other spots after that code that needed to be corrected as well. Can you verify this patch works?
Comment 8 Thomas Lange 2014-12-08 19:38:56 CET
This one fixes the issue, thanks. No more segfaults. :)
Comment 9 Eric Koegel editbugs 2014-12-10 17:48:31 CET
Thanks for verifying, pushed to master in:
commit 2fb1b8f8313d6246dc7f79b35bd5a2fab6c41282
Author: Eric Koegel <eric.koegel@gmail.com>
Date:   Mon Dec 8 15:33:07 2014 +0300

    Gracefully handle the sessions dir being readonly (Bug #11307)
    
    If the user has their ~/.cache/sessions directory set as read-only
    xfsm would crash on logout. This patch has xfsm check before it
    writes to that folder location.
http://git.xfce.org/xfce/xfce4-session/commit/?id=2fb1b8f8313d6246dc7f79b35bd5a2fab6c41282
Comment 10 Peter de Ridder editbugs 2015-03-10 08:42:14 CET
Thomas could you test the current git master again?

This patch has been reverted as it blocked initial sessions saving.

If current git master segfaults again, we need to reopen this bug and find a different solution.
Comment 11 Thomas Lange 2015-03-10 09:50:29 CET
(In reply to Peter de Ridder from comment #10)
> Thomas could you test the current git master again?

Sure, it works fine. There are no segfaults.

Bug #11307

Reported by:
Thomas Lange
Reported on: 2014-11-16
Last modified on: 2015-03-10

People

Assignee:
Eric Koegel
CC List:
5 users

Version

Version:
4.10.1

Attachments

Additional information