I was suffering from this on El Capitan. It was driving me crazy. Just when I did something memory- or processor-intensive, the screen would start flickering in bands and would throw me back to the logon screen shortly afterwards. I lost a lot of work over a period of several weeks.
About a week ago, I made several changes at the same time (I know, I know, not good problem determination, but I was getting desperate) and it's now stopped. So I've narrowed it down to 4 things in my case (but I think it was probably number 4):
- I removed one of my fave apps, jitouch;
- In Preferences > General, I unchecked Use dark menu bar and Dock
- Preferences > Accessibility, I unchecked Reduce Transparency
- (Almost certainly the cuprit) I had previously converted (with PST Converter Pro from the app store) tons of email archives from the last 15 years and imported them in Apple Mail (I previously had these in local .pst files, to use with MS Outlook/Exchange). I deleted them from Mail about a week ago, around when the problem stopped (sorry I can't be more precise; my reason for deleting them was not to solve this problem, but because I got tired of Mail's search picking up old stuff that I didn't need every time).
I have not been bounced to the logon screen since doing all of these things. I think that the issue was almost certainly related to a massive volume of emails and one of Mail/Spotlight/Finder was having a fit trying to keep track of them all.
When I have time, I'll re-enable 1, 2, and 3 (I'll post back if the problem re-occurs as a result), but I'll leave the emails out of Mail for now. I've lost so much productivity over the last couple of months that I don't want to risk this re-occuring.