Why functions.php file automatically empty?

As far as I can think of this is a server issue. This has happened to me once due to server crash.

I hope you have a backup of your files.