Originally Posted by nkataria
should I look into logic in my code for finding out the problem.
I would start looking for a problem with a shared variable. These intermittent type problems in a multi-threaded application are often caused by failure to lock/unlock a shared resource correctly.
P.S. If a problem is unpredictably intermittent that is a good indication that it is a hardware problem instead of a software problem. So I can see why people are inclined to diagnose your problem as being a hardware problem.
But software problems with lock/unlock logic can be intermittent due to the random timing of when two different threads happen to access a shared resource incorrectly at the same time.
In C the lock logic is called mutexes. Here is an explanation of mutexes.