When plugging a second external monitor, macOS Sierra "logs out" (crashes?) user session. I get presented with the login window. No error message.
It's not just "show login window", because all apps load anew after logging in (which takes a very loooong time, killing my productivity).
macOS Sierra 10.12.3 (16D32).
DisplayPort external monitors.
MacBook Pro Retina Late 2013, 13".
I don't recall this happening on El Capitan. I upgraded to sierra yesterday.
There is no error message, like "was not closed normally", therefore I believe this is not a duplicate of After Installing El Capitan I Will be Logged Out Frequently (and mine is about Sierra).
I do not see anything interesting in Console logs (although maybe someone could point me to where to look).
What could be causing this? How to prevent this from happening?
What diagnostics can I do?
Edit: Some other considerations:
I was fiddling with SwitchResX for custom display modes (HiDPI on external displays). As described in: 1280x720 HiDPI resolution for 2560x1440 monitor
there is no corrupted graphics like in the other question(s)
Edit 2: The main monitor is: LG 27UD88-W Monitor 27" UHD 4K USB-C USB 3.0, connected via DisplayPort
Edit 3: The problem also happens when I unplug the monitor (or switch the monitor, in its own menu, to use another input cable)
Edit 4: Also posted on Apple support: https://discussions.apple.com/message/31686056
Edit 5: Also uninstalled SwitchResX (via their menu). Problem still happens!