Bug 1489977 - Switching users in GNOME session is starting new X servers for the user, and a user logout is making it unusable.
Summary: Switching users in GNOME session is starting new X servers for the user, and ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gnome-session
Version: 7.4
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Ray Strode [halfline]
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks: 1571842 1607454 1707454 1588877 1597339 1632807 1635747 1636460 1636519 1640918 1649362
TreeView+ depends on / blocked
 
Reported: 2017-09-08 21:17 UTC by amit yadav
Modified: 2019-08-06 12:38 UTC (History)
12 users (show)

Fixed In Version: gdm-3.28.2-7.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1588877 1635747 1636460 1636519 (view as bug list)
Environment:
Last Closed: 2019-08-06 12:37:16 UTC
Target Upstream Version:


Attachments (Terms of Use)
Xorg.0.log (29.02 KB, text/plain)
2018-09-27 17:32 UTC, amit yadav
no flags Details
journalctl logs (1.99 MB, text/plain)
2018-09-27 17:32 UTC, amit yadav
no flags Details
Xorg.0.log.old (56.05 KB, text/plain)
2018-09-28 07:00 UTC, amit yadav
no flags Details
Xorg.1.log (31.55 KB, text/plain)
2018-09-28 07:00 UTC, amit yadav
no flags Details
Xorg.1.log.old (49.87 KB, text/plain)
2018-09-28 07:01 UTC, amit yadav
no flags Details
Xorg.2.log (31.02 KB, text/plain)
2018-09-28 07:02 UTC, amit yadav
no flags Details
qxl driver fix (582 bytes, patch)
2018-10-03 14:35 UTC, Ray Strode [halfline]
no flags Details | Diff
gdm journal (219.26 KB, text/plain)
2018-10-04 15:16 UTC, Jiri Koten
no flags Details
this should fix it (4.08 KB, patch)
2018-10-04 18:08 UTC, Ray Strode [halfline]
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1632807 None CLOSED User session is terminated after User Switch 2019-10-23 17:03:05 UTC
Red Hat Knowledge Base (Solution) 3559061 None None None 2018-08-09 19:46:17 UTC
Red Hat Product Errata RHBA-2019:2044 None None None 2019-08-06 12:38:31 UTC

Internal Links: 1632807

Description amit yadav 2017-09-08 21:17:17 UTC
Description of problem:

On version RHEL 7.3 if you press CTL+ATL+F1 that would ALWAYS be the GUI (GNOME Desktop). In RHEL 7.4 the CTL+ATL+F1  is the what the 1st user gets and CTL+ATL+F4 is what the second user get when he/she logs into the system. User A logs in and get the ...+F1 virtual terminal. Then User B switched-user and logs in and gets ...+F4.   User A comes back and logs into his session then logs out.  At this point the CTL+ALT+F1  virtual terminal crashes (or errors out) and doesn’t display a new login screen for the next user.  All we see is a CLI screen with a bunch of Xsession exit messages.   If that user wants to login to that machine he has to cycle through each ...+F2 , then ...+F3, then ...+F4 until he find User B's GUI session and switch user from his screen.

Version-Release number of selected component (if applicable):
gnome-session-3.22.3-4.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Login into system as user A and check ps output
2. Switch to user B and check ps command output. It will show two X servers on different TTY
3. Switch back to first user - A and logout from his session. Gnome session disappears and getting blank screen
4. Press ctrl+alt+f2/3/4... untill you get GUI started on other TTY

Actual results:
When switching users it is launching multiple X servers, and when a user logout from his GUI session, login screen do not appears. Getting blank screen only.

Expected results:
When switching users it should not launch multiple X servers, and when a user logout from his GUI session, login screen should appear.

Additional info:
Issue is reproducible on newly installed RHEL7.4 systems on test systems.

Comment 13 Ray Strode [halfline] 2018-07-30 20:57:45 UTC
should hopefully work better with gdm-3.28.2-7.el7

Comment 19 amit yadav 2018-09-27 17:32:01 UTC
Created attachment 1487830 [details]
Xorg.0.log

Comment 20 amit yadav 2018-09-27 17:32:39 UTC
Created attachment 1487831 [details]
journalctl logs

Comment 24 amit yadav 2018-09-28 07:00:21 UTC
Created attachment 1487982 [details]
Xorg.0.log.old

Comment 25 amit yadav 2018-09-28 07:00:54 UTC
Created attachment 1487983 [details]
Xorg.1.log

Comment 26 amit yadav 2018-09-28 07:01:19 UTC
Created attachment 1487984 [details]
Xorg.1.log.old

Comment 27 amit yadav 2018-09-28 07:02:13 UTC
Created attachment 1487985 [details]
Xorg.2.log

Comment 34 Ray Strode [halfline] 2018-10-03 14:35:52 UTC
Created attachment 1490121 [details]
qxl driver fix

So, this doesn't seem to be a duplicate of bug 1632807 after all.

I instrumented the kernel to highlight when master was getting dropped and set and we were clearly failing to call drop master in the existing X server before doing set master in the switched X server. master ownership is important for being able to set the screen resolution and display contents on screen.

The problem is that when the X server is killed it does a VT switch back to the VT it was started from.  Normally switching to another VT leads to master getting dropped, but in this termination case, they don't, since the event loop is finished before the VT switch is initiated.

Most drivers workaround this problem by having this sort of code in their CloseScreen hook:

if (pScrn->LeaveVT)
     pScrn->LeaveVT (...);

This LeaveVT call, simulates the leave vt event that would come in if the event loop were still active.

I say most drivers, but not all.  The QXL driver fails to implement this workaround.  The above patch fixes the issue for me.

Doing a quick search, though, the vmware driver also fails to call LeaveVT from CloseScreen, so I think, maybe, a better approach would be to call the LeaveVT hook from somewhere more generic like xf86CrtcCloseScreen or maybe a new xf86 ddx CloseScreen hook.

Comment 35 Ray Strode [halfline] 2018-10-03 14:38:19 UTC
btw, i think we should move this bug back to VERIFIED, and clone for the qxl issue, since it really is separate, so I'll do that shortly.

Comment 36 Ray Strode [halfline] 2018-10-03 15:12:41 UTC
Okay i've filed bug 1635747 to cover the xserver/qxl issue.

Comment 39 Jiri Koten 2018-10-04 15:16:11 UTC
Reproducer:

1) Login user1
2) Switch and login user2
3) Switch and login user3
4) Switch and unlock user1
5) Logout user1
6) Login user2
7) Logout user2

After that no greeter session is started and I ended in console tty2. Switching to VT1 didn't trigger the greeter session either, I have to go to user3 session (VT3) and switch user to get the greeter.

Comment 40 Jiri Koten 2018-10-04 15:16:46 UTC
Created attachment 1490619 [details]
gdm journal

Comment 41 Jiri Koten 2018-10-04 15:22:38 UTC
Tested on RC compose:

kernel-3.10.0-954.el7
gdm-3.28.2-9.el7
xorg-x11-server-Xorg-1.20.1-3.el7

No crash of Xorg happend.

Comment 42 Ray Strode [halfline] 2018-10-04 17:35:29 UTC
okay filtering the log a little:

> Oct 04 16:58:36 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 16:58:36 hal gdm[5481]: GdmDisplay: session id: c1
> Oct 04 16:58:36 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '5627'
first login screen started

> Oct 04 16:58:41 hal gdm-password][6130]: GdmSessionWorker: queuing setup for user: test (null)
> Oct 04 16:58:46 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 16:58:48 hal gdm[5481]: GdmDisplay: session id: 1
> Oct 04 16:58:48 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '6173'
user1 logged in

> Oct 04 17:01:06 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:01:06 hal gdm[5481]: GdmDisplay: session id: c2
> Oct 04 17:01:06 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '8270'
second login screen started

> Oct 04 17:01:14 hal gdm-password][8595]: GdmSessionWorker: queuing setup for user: test67 (null)
> Oct 04 17:01:14 hal gdm[5481]: using ut_pid 8596
> Oct 04 17:01:16 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:01:25 hal gdm[5481]: GdmDisplay: session id: 6
> Oct 04 17:01:25 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '8668'
user2 logged in

> Oct 04 17:01:45 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:01:45 hal gdm[5481]: GdmDisplay: session id: c3
> Oct 04 17:01:45 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '9495'
third login screen started

> Oct 04 17:02:02 hal gdm[5481]: GdmSession: Emitting 'reauthenticated' signal
> Oct 04 17:02:03 hal gdm[5481]: GdmServer: Server died
third login screen finished

> Oct 04 17:02:03 hal gdm[5481]: Unlocking session 1
user1 unlocked

> Oct 04 17:02:33 hal gdm[5481]: Writing logout record
> Oct 04 17:02:33 hal gdm[5481]: using ut_pid 6173
> Oct 04 17:02:33 hal gdm[5481]: GdmServer: Server died
user1 logged out

> Oct 04 17:02:34 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:02:34 hal gdm[5481]: GdmDisplay: session id: c4
> Oct 04 17:02:34 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '10396'
fourth login screen started

> Oct 04 17:02:42 hal gdm[5481]: GdmSession: Emitting 'reauthenticated' signal
> Oct 04 17:02:43 hal gdm[5481]: GdmServer: Server died
fourth login screen finished

> Oct 04 17:02:43 hal gdm[5481]: Unlocking session 6
user2 unlocked

> Oct 04 17:03:18 hal gdm[5481]: Writing logout record
> Oct 04 17:03:18 hal gdm[5481]: using ut_pid 8668
> Oct 04 17:03:18 hal gdm[5481]: GdmServer: Server died
user2 logged out

> Oct 04 17:03:19 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:03:19 hal gdm[5481]: GdmDisplay: session id: c5
> Oct 04 17:03:19 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '11009'
fifth login screen started

> Oct 04 17:03:30 hal gdm-password][11296]: GdmSessionWorker: queuing setup for user: test (null)
> Oct 04 17:03:34 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:03:36 hal gdm[5481]: GdmDisplay: session id: 7
> Oct 04 17:03:36 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '11334'
user1 logged in again

> Oct 04 17:04:04 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:04:04 hal gdm[5481]: GdmDisplay: session id: c6
> Oct 04 17:04:04 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '12410'
sixth login screen started

> Oct 04 17:04:09 hal gdm-password][12699]: GdmSessionWorker: queuing setup for user: test67 (null)
> Oct 04 17:04:11 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:04:14 hal gdm[5481]: GdmDisplay: session id: 8
> Oct 04 17:04:14 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '12737'
user2 logged in again

> Oct 04 17:04:25 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:04:25 hal gdm[5481]: GdmDisplay: session id: c7
> Oct 04 17:04:25 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '13457'
seventh login screen started

> Oct 04 17:04:34 hal gdm-password][13753]: GdmSessionWorker: queuing setup for user: gstest (null)
> Oct 04 17:04:34 hal gdm[5481]: using ut_pid 13754
> Oct 04 17:04:37 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:04:45 hal gdm[5481]: GdmDisplay: session id: 9
> Oct 04 17:04:46 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '13810'
user3 logged in

> Oct 04 17:04:58 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:04:58 hal gdm[5481]: GdmDisplay: session id: c8
> Oct 04 17:04:58 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '14527'
eigth login screen started

> Oct 04 17:05:07 hal gdm[5481]: GdmSession: Emitting 'reauthenticated' signal
> Oct 04 17:05:07 hal gdm[5481]: GdmServer: Server died
eigth login screen finished

> Oct 04 17:05:07 hal gdm[5481]: Unlocking session 7
user1 unlocked

> Oct 04 17:05:23 hal gdm[5481]: Writing logout record
> Oct 04 17:05:23 hal gdm[5481]: using ut_pid 11334
> Oct 04 17:05:23 hal gdm[5481]: GdmServer: Server died
user1 logged out

> Oct 04 17:05:24 hal gdm[5481]: GdmSession: Emitting 'session-opened' signal
> Oct 04 17:05:24 hal gdm[5481]: GdmDisplay: session id: c9
> Oct 04 17:05:24 hal gdm[5481]: GdmSession: Emitting 'session-started' signal with pid '15343'
ninth login screen started

> Oct 04 17:05:37 hal gdm[5481]: GdmSession: Emitting 'reauthenticated' signal
> Oct 04 17:05:37 hal gdm[5481]: GdmServer: Server died
ninth login screen finished

> Oct 04 17:05:37 hal gdm[5481]: Unlocking session 8
user2 unlocked

> Oct 04 17:05:48 hal gdm[5481]: Writing logout record
> Oct 04 17:05:48 hal gdm[5481]: using ut_pid 12737
> Oct 04 17:05:48 hal gdm[5481]: GdmServer: Server died
user2 logged out

at this point a login screen should get created, but it doesn't

Comment 43 Ray Strode [halfline] 2018-10-04 17:54:00 UTC
i think what's going on is we're hitting a race condition with logind potentially in this code in create_display:

```
        ret = sd_seat_get_active (seat_id, &active_session_id, NULL);•
•
        if (ret == 0) {•
                char *login_session_id = NULL;•
•
                /* If we already have a login window, switch to it */•
                if (get_login_window_session_id (seat_id, &login_session_id)) {•
                        if (g_strcmp0 (active_session_id, login_session_id) != 0) {•
                                activate_session_id (factory, seat_id, login_session_id);•
                        }•
                        g_clear_pointer (&login_session_id, g_free);•
                        g_clear_pointer (&active_session_id, g_free);•
                        return NULL;•
                }•
                g_clear_pointer (&active_session_id, g_free);•
        } else {•
                /* Ensure we don't create the same display more than once */•
                display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id);•
•
                if (display != NULL) {•
                        return NULL;•
                }•
        }•
```

When user2 logs out the X server jumps back to user1's vt, but user1 is logged out, so it's blank.  `sd_seat_get_active` is returning non-zero since there's no session on the active vt anymore, so we're falling into the non-seat0 `else` block inadvertently, and returning NULL without doing anything.

we shouldn't be checking for whether or not the seat has an active session like that. it's apparently to avoid doing a full activation if we're already on the correct VT, but it's misplaced.

Comment 44 Ray Strode [halfline] 2018-10-04 18:08:15 UTC
Created attachment 1490684 [details]
this should fix it

Comment 46 Jiri Koten 2018-10-05 12:53:08 UTC
(In reply to Ray Strode [halfline] from comment #44)
> Created attachment 1490684 [details]
> this should fix it

I can confirm the fix worked for me. The login screen always starts when I switch user or logout.

The only issue I have found is that sometimes when I unlock the user session the screen remains blank and I have to move mouse to wake up the screen.

Comment 47 Ray Strode [halfline] 2018-10-05 13:00:10 UTC
okay thats probably an unrelated issue in mutter.  lets clone that for 7.7

Comment 48 Ray Strode [halfline] 2018-10-05 13:08:02 UTC
ive cloned the remaining issue as bug 1636460

Comment 54 errata-xmlrpc 2019-08-06 12:37:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2044


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