Comment 7 for bug 1256150

Revision history for this message
Alistair Buxton (a-j-buxton) wrote :

I now know exactly what causes this bug. The problem is that the VT gets unref'd once when the server shuts down, and then unref'd again much later when the object gets finalized. This might happen after the VT has already been allocated and ref'd to another server. This makes lightdm think the VT is free, when it isn't.

This is an annotated log, with extra debugging code added:

*** I've logged in (once) and now I log out for the first time.

[+34.12s] DEBUG: Session pid=13236: Exited with return value 0
[+34.12s] DEBUG: Seat: Session stopped
[+34.12s] DEBUG: Seat: Stopping display server, no sessions require it
[+34.12s] DEBUG: Sending signal 15 to process 13176
[+34.47s] DEBUG: Process 13176 exited with return value 0
[+34.47s] DEBUG: DisplayServer x-0: X server stopped :0, pid was 0
[+34.47s] DEBUG: Releasing VT 7

*** The display server shuts down and the VT is unref'd.

[+34.47s] DEBUG: DisplayServer x-0: Removing X server authority /var/run/lightdm/root/:0
[+34.47s] DEBUG: Seat: Display server stopped
[+34.47s] DEBUG: Seat: Active display server stopped, starting greeter
[+34.47s] DEBUG: Seat: Creating greeter session
[+34.47s] DEBUG: Seat: Setting XDG_SEAT=seat0
[+34.47s] DEBUG: Seat: Creating display server of type x
[+34.47s] DEBUG: Seat: Starting local X display

*** New server starts for the login screen

[+34.47s] DEBUG: DisplayServer x-0: Set VT of server:0 to 7

*** It uses VT7 because it's unref'd

[+34.47s] DEBUG: Using VT 7

*** This causes VT7 to get ref'd.

[+34.47s] DEBUG: DisplayServer x-0: Logging to /var/log/lightdm/x-0.log
[+34.47s] DEBUG: DisplayServer x-0: Writing X server authority to /var/run/lightdm/root/:0
[+34.47s] DEBUG: DisplayServer x-0: Launching X Server
[+34.47s] DEBUG: Launching process 13592: /usr/bin/X -core :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
[+34.47s] DEBUG: DisplayServer x-0: Waiting for ready signal from X server :0, pid=13592

*** New server launches.

[+34.47s] DEBUG: DisplayServer x-0: In finalize (null): vt=7
[+34.48s] DEBUG: Releasing VT 7

*** The old x-server-local object gets finalized, which causes VT7 to get unref'd for a second time. The next server that starts up will start on VT7, which is really currently already used.