From within recovery mode:
1. Delete the .Xauthority and .ICEauthority files from your home directory (if they exist):
...replace <USER> with your actual userid.
2. Check that you haven't run out of disk space:
3. Delete your cached sessions:
4. And finally, check the xsessions log file for any error messages that might help identify a cause for the automatic logout (if anything exists, it will be towards the end of the file)
rm -rf sessions
Then reboot and see if you get to the desktop.