That was probably due to a lot of factors but most importantly I was not feeling well with my advisors and I did not believe in what I was doing (though I could present it in a convincing way).
I won't fix your burnout but here are things to check:
- Do you enjoy working with the people you work with?
- Do you believe in what you do? You can do any technically interesting thing in the world, but if it has no meaning for you, or worse, you think it is harmful or works against your values, that's a way to burn out pretty quickly.
- Do you really like what you do? (that's not the same question)
- is there a relationship in which you don't feel that well? Find out why, fix it or end it. Careful, if you are burnt out you could be seeing it from a pessimistic perspective.
Allow yourself to be unproductive / inefficient in your free time and to enjoy it. Take some time for yourself. You cannot really enjoy things you do usually, but maybe you can focus on making your wife, friends, family happy if you can help it, because it can be very rewarding. Don't be hard on yourself, you are not a god (afaik).
Try to rest. I have sleeping issues, I find it very hard to turn off my brain, but listening to interesting things while trying to sleep works pretty well for me, it is a good distraction. Being tired is shitty.
Maybe try something new, maybe learn to play music? It's hard, takes a lot of work, and a lot of time, but it is something you can take refuge in. And learning it is nothing like learning a new programming language or a new framework so you might find out interesting things about yourself.
I need meaning. Maybe you too? If so, seek meaning somewhere or everywhere in your life. Take time to think. This might lead you to a new job with a lower income or less technically challenging, but in which you believe and which relates to your values.
In your quest of meaning, you might end up finding out that life is quite meaningless and has no goal. If so, you could conclude that you are free and that the best you can do is to fully enjoy life within the limits set by your values :-)