iMac randomly logging out (High Sierra and Mojave)
TLDR: In my case, SwitchResX seems to be the culprit. Didn't look for a workaround yet.



I just experienced the same logout, with similar logs:

Jun  2 15:21:55 Trema syslogd[48]: ASL Sender Statistics
Jun  2 15:24:07 Trema com.apple.xpc.launchd[1] (com.apple.quicklook[8406]): Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.quicklook
Jun  2 15:24:35 Trema com.apple.xpc.launchd[1] (com.apple.WindowServer[205]): Service exited due to SIGABRT
Jun  2 15:24:35 Trema VDCAssistant[203]: BUG in libdispatch client: mach_recv, monitored resource vanished before the source cancel handler was invoked { 0x7fb4e8c0b840[source], ident: 6191 / 0x182f, handler: 0x107f6fa6c }
Jun  2 15:24:35 Trema com.apple.xpc.launchd[1] (com.apple.ViewBridgeAuxiliary[8527]): Service exited with abnormal code: 2
Jun  2 15:24:35 Trema com.apple.xpc.launchd[1] (com.apple.ViewBridgeAuxiliary): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Jun  2 15:24:35 Trema sessionlogoutd[8526]: DEAD_PROCESS: 102 console
Jun  2 15:24:35 Trema com.apple.xpc.launchd[1] (com.apple.UserEventAgent-Aqua[606]): Service exited due to SIGKILL | sent by UserEventAgent[606]
Jun  2 15:24:35 Trema com.apple.xpc.launchd[1] (com.apple.WebKit.WebContent.BE261D11-9005-48E6-9B64-31D068C12BB4[4827]): Service exited with abnormal code: 1
Jun  2 15:24:35 Trema com.apple.xpc.launchd[1] (com.apple.WebKit.WebContent.5B14717F-EC42-44AC-BE76-917F52D439A9[4829]): Service exited with abnormal code: 1
Jun  2 15:24:35 Trema com.apple.xpc.launchd[1] (com.adobe.GC.AGM[1366]): Service exited with abnormal code: 15
Jun  2 15:24:35 Trema com.apple.xpc.launchd[1] (com.apple.Dock.agent[662]): Service exited with abnormal code: 1


As suggested by @Ruskes, I ran the command sudo log show --start "2020-06-02 15:24:00" --info --debug --signpost and saw these interesting lines: 

2020-06-02 15:24:34.477103+0200 0x4a3      Default     0x0                  0      0    kernel: (AppleIntelFramebufferAzul) Unsupported Extended capabilities type: 0x100
2020-06-02 15:24:34.477135+0200 0x4a3      Default     0x0                  0      0    kernel: (AppleIntelFramebufferAzul) Currently unsupported feature requested
2020-06-02 15:24:34.477171+0200 0x4a3      Default     0x0                  0      0    kernel: (AppleIntelFramebufferAzul) Currently unsupported feature requested
2020-06-02 15:24:34.477203+0200 0x4a3      Default     0x0                  0      0    kernel: (AppleIntelFramebufferAzul) Currently unsupported feature requested
2020-06-02 15:24:34.477238+0200 0x4a3      Default     0x0                  0      0    kernel: (AppleIntelFramebufferAzul) Currently unsupported feature requested
2020-06-02 15:24:34.477272+0200 0x4a3      Default     0x0                  0      0    kernel: (AppleIntelFramebufferAzul) Currently unsupported feature requested
2020-06-02 15:24:34.477300+0200 0x4a3      Default     0x0                  0      0    kernel: (AppleIntelFramebufferAzul) Currently unsupported feature requested
2020-06-02 15:24:34.480826+0200 0x4a3      Error       0x0                  205    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [ERROR] - Driver bug - rowBytes too small. Display 0x1c81a9e2, ioModeID 0x80005000, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 7680 stored width = 1920. Forcing minRowBytes (possibly still wrong).
2020-06-02 15:24:34.480844+0200 0x4a3      Error       0x0                  205    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [ERROR] - Driver bug - rowBytes too small. Display 0x1c81a9e2, ioModeID 0x80005001, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 4096 stored width = 1024. Forcing minRowBytes (possibly still wrong).
2020-06-02 15:24:34.480858+0200 0x4a3      Error       0x0                  205    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [ERROR] - Driver bug - rowBytes too small. Display 0x1c81a9e2, ioModeID 0x80005002, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 4096 stored width = 1024. Forcing minRowBytes (possibly still wrong).
2020-06-02 15:24:34.480872+0200 0x4a3      Error       0x0                  205    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [ERROR] - Driver bug - rowBytes too small. Display 0x1c81a9e2, ioModeID 0x80005003, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 3200 stored width = 800. Forcing minRowBytes (possibly still wrong).
2020-06-02 15:24:34.480886+0200 0x4a3      Error       0x0                  205    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [ERROR] - Driver bug - rowBytes too small. Display 0x1c81a9e2, ioModeID 0x80005004, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 3200 stored width = 800. Forcing minRowBytes (possibly still wrong).
2020-06-02 15:24:34.480900+0200 0x4a3      Error       0x0                  205    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [ERROR] - Driver bug - rowBytes too small. Display 0x1c81a9e2, ioModeID 0x80005005, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 2560 stored width = 640. Forcing minRowBytes (possibly still wrong).
2020-06-02 15:24:34.480913+0200 0x4a3      Error       0x0                  205    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [ERROR] - Driver bug - rowBytes too small. Display 0x1c81a9e2, ioModeID 0x80005006, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 2560 stored width = 640. Forcing minRowBytes (possibly still wrong).

[...]

2020-06-02 15:24:35.254853+0200 0x4a3      Default     0x0                  205    7    WindowServer: (CoreDisplay) [com.apple.CoreDisplay:default] [WARN] - description_for_mode_number: Illegal mode number -1 for display 003f003f
2020-06-02 15:24:35.255600+0200 0x269      Default     0x0                  102    5    loginwindow: [com.apple.loginwindow.logging:Standard] -[LoginApp windowServerExited] | enter
2020-06-02 15:24:35.255630+0200 0x4c6      Default     0x0                  0      0    kernel: (AppleIntelFramebufferAzul) Transitioning wsaa from 1-&gt;0
2020-06-02 15:24:35.255684+0200 0x269      Default     0x0                  102    5    loginwindow: [com.apple.loginwindow.logging:LWError] -[LoginApp windowServerExited] | ERROR | Window Server exited, closing down the session immediately
2020-06-02 15:24:35.255886+0200 0xd90d     Default     0x0                  664    0    SystemUIServer: (HIToolbox) HIToolbox: received notification of WindowServer event port death.
2020-06-02 15:24:35.255930+0200 0xd90d     Default     0x0                  664    0    SystemUIServer: (HIToolbox) port matched the WindowServer port created in BindCGSToRunLoop
2020-06-02 15:24:35.256039+0200 0x269      Default     0x0                  102    5    loginwindow: [com.apple.loginwindow.logging:Standard] -[SessionLogoutManager startDirectLogout:reason:] | Enter, logoutType: Logout,  directLogoutReason:WindowServerExited
2020-06-02 15:24:35.256041+0200 0x269      Default     0x0                  102    5    loginwindow: [com.apple.loginwindow.logging:Standard] -[SessionLogoutManager startDirectLogout:reason:] | Window server exit, calling doDirectLogoutFinalItemsBeforeSessionLogoutd
2020-06-02 15:24:35.256050+0200 0xd906     Default     0x0                  661    0    talagent: (HIToolbox) HIToolbox: received notification of WindowServer event port death.
2020-06-02 15:24:35.256096+0200 0xd906     Default     0x0                  661    0    talagent: (HIToolbox) port matched the WindowServer port created in BindCGSToRunLoop
2020-06-02 15:24:35.256113+0200 0xd7fe     Default     0x0                  624    0    Google Chrome: (HIToolbox) HIToolbox: received notification of WindowServer event port death.
2020-06-02 15:24:35.256124+0200 0x269      Default     0x0                  102    5    loginwindow: [com.apple.loginwindow.logging:Standard] -[SessionLogoutManager doDirectLogoutFinalItemsBeforeSessionLogoutd] | enter
2020-06-02 15:24:35.256154+0200 0xd7fe     Default     0x0                  624    0    Google Chrome: (HIToolbox) port matched the WindowServer port created in BindCGSToRunLoop
2020-06-02 15:24:35.256200+0200 0x65e31    Default     0x0                  8184   0    ProtonMail Bridge: (HIToolbox) HIToolbox: received notification of WindowServer event port death.
2020-06-02 15:24:35.256214+0200 0x269      Default     0x0                  102    5    loginwindow: [com.apple.loginwindow.logging:Standard] -[SessionLogoutManager doCommonFinalItems] | enter
2020-06-02 15:24:35.256216+0200 0x269      Signpost    0x0                  102    0    [spid excl, process, event] loginwindow: [com.apple.loginwindow.logging:performance_instrumentation] Dock_Dies


I have two external displays, and use SwitchResX to adjust one screen's display to force a retina-like 1440p density over 1080p (connected by HDMI), and another screen (through VGA-MiniDisplay adapter) is simply at 1080p.

The first errors in the detailed logs seems related to SwitchResX's custom resolutions (note the 1920, 1024, 800…), as it registers potentially unsupported resolutions.

For now, I deduce that this triggers WindowServer failure, then logouts, but didn't find a workaround yet.

Any input appreciated!