OSX Locking then logging out

Having trouble with OSX on a MacBook Pro.

My system randomly locks up, becoming completely unresponsive to mouse or keyboard, then after a few seconds shows the OSX login screen, at which point it is responding to the mouse and keyboard again. There doesn't seem to be any specific thing causing it, from what I can tell.

I was wondering if this has happened to anyone else and if so do they know how to fix the issue?

If there is any commands that I can run to give more information please let me know. If it happens again I'll be trying to record it to put up on youtube.

Bought from apple site in April 2013 so not an old one.

Spec

2.9 GHz Intel Core i7
8GB 1600MHz DDR Ram
750GB HDD
Intel HD Graphics 4000 512 MB
OSX 10.8.4 (12E55)

Edit

  • Log 1 on pastebin.com
  • Log 2 on pastebin.com

Updated with the log from is happening a few minutes ago.


Solution 1:

I have experienced similar problems with my MacBook Pro when I drop my earphones near the left side of my keyboard. I believe the MacBook uses magnets to detect the screen lid is closed, so when the magnetic field of the earphones get near the Macbook case it thinks the screen was closed and locks the system.

I have ever since placed my earphones somewhere else, far from the MacBook case and never had this problem again.

Check if you don't have any strong magnetic fields near your computer, even if a bit far from it.