Skip to content

loginDialog: Don't call _loginScreenSessionActivated() when not required

We are calling _loginScreenSessionActivated() even in cases where this is not required. For example, there are cases where the Active property is already true and properties like IdleHint, IdleSinceHint and IdleSinceHintMonotonic change. In this cases _loginScreenSessionActivated() is called and will reset the authPrompt when not necessary.

This prevents a race condition that happens when the Single Sign-On code is triggered. If another property changes while we are performing a GDM conversation, it happens that a second conversation is started just before spawning the user session. This makes gnome-shell think that the service failed and will return an error instead of opening the user session.

This is the main error:

Aug 05 18:05:39 ip-198-19-76-222 gdm3[837]: Gdm: GdmSession: conversation dcv-graphical-sso started more than once
Aug 05 18:05:39 ip-198-19-76-222 gnome-shell[1006]: _reportInitError dcv-graphical-sso
Aug 05 18:05:39 ip-198-19-76-222 gnome-shell[1006]: JS ERROR: Failed to start dcv-graphical-sso verification: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.Spawn.Failed: Could not create authentication >
                                                    _promisify/proto[asyncFunc]/</<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:425:45
                                                    ### Promise created here: ###
                                                    _startService@resource:///org/gnome/shell/gdm/util.js:629:42
                                                    _beginVerification@resource:///org/gnome/shell/gdm/util.js:652:14
                                                    _getUserVerifier@resource:///org/gnome/shell/gdm/util.js:554:14
                                                    async*begin@resource:///org/gnome/shell/gdm/util.js:256:18
                                                    begin@resource:///org/gnome/shell/gdm/authPrompt.js:667:28
                                                    _hideUserListAndBeginVerification@resource:///org/gnome/shell/gdm/loginDialog.js:1171:26
                                                    _onReset@resource:///org/gnome/shell/gdm/loginDialog.js:889:18
                                                    reset@/usr/share/gnome-shell/extensions/nice-dcv@amazon.com/extension.js:100:14
                                                    _loginScreenSessionActivated@resource:///org/gnome/shell/gdm/loginDialog.js:976:30
                                                    _gotGreeterSessionProxy/<@resource:///org/gnome/shell/gdm/loginDialog.js:991:22

This is a simplified timeline of the events:

Aug 05 18:05:38 ip-198-19-76-222 gnome-shell[1006]: UserAuthenticated emitted 1d9e110dc72008ceeaf6ca7e4f9a5e45
Aug 05 18:05:38 ip-198-19-76-222 gnome-shell[1006]: _startService dcv-graphical-sso
Aug 05 18:05:38 ip-198-19-76-222 gnome-shell[1006]: _onConversationStarted: dcv-graphical-sso
Aug 05 18:05:38 ip-198-19-76-222 gnome-shell[1006]: _onSecretInfoQuery: dcv-graphical-sso
Aug 05 18:05:38 ip-198-19-76-222 gnome-shell[1006]: token 1d9e110dc72008ceeaf6ca7e4f9a5e45 get
Aug 05 18:05:38 ip-198-19-76-222 dcv-graphical-sso][1591]: pam_unix(dcv-graphical-sso:session): session opened for user maxibon-ubuntu-10@ubuntu.maxibon(uid=522601118) by (uid=0)
Aug 05 18:05:38 ip-198-19-76-222 gnome-shell[1006]: _onVerificationComplete: dcv-graphical-sso
Aug 05 18:05:39 ip-198-19-76-222 gnome-shell[1006]: Properties changed: IdleHint, IdleSinceHint, IdleSinceHintMonotonic - Active: true
Aug 05 18:05:39 ip-198-19-76-222 gnome-shell[1006]: _loginScreenSessionActivated: opacity 255 verificationStatus 3
Aug 05 18:05:39 ip-198-19-76-222 gnome-shell[1006]: _startService: dcv-graphical-sso
Aug 05 18:05:39 ip-198-19-76-222 gdm3[837]: Gdm: GdmSession: conversation dcv-graphical-sso started more than once
Aug 05 18:05:39 ip-198-19-76-222 gnome-shell[1006]: _reportInitError: dcv-graphical-sso
Aug 05 18:05:39 ip-198-19-76-222 gnome-shell[1006]: JS ERROR: Failed to start dcv-graphical-sso verification: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.Spawn.Failed: Could not create authentication helper process
Aug 05 18:05:39 ip-198-19-76-222 gnome-shell[1006]: _verificationFailed: dcv-graphical-sso shouldRetry false
Edited by Alessandro Bono

Merge request reports