Quote:
1) How can i make sure that same thing would not be happen in future?
You cannot do that. However you might possibly cut the odds of such a failure, by fixing your bugs.
Quote:
2) What are all the necessary action should i take to eliminate this issue in future?
Again, a 100% bug free code is just a chimera. However good debuggin and better testing could improve a lot the reliability of your server.