0

I've got a compiled executable here that can't decide whether to run or crash. I keep invoking it from the command line (without re-compiling) and it keeps behaving differently. Sometimes it loads the UI without problems. Other times it immediately crashes with a runtime exception.

I can't find a pattern of runs and crashes that helps me identify the cause, so I'm asking generally:

What can cause this behavior in a compiled program? What kinds of bugs/conditions can lead to exceptions being thrown sometimes but not every time?

Jared K
  • 241
  • 2
  • 8

1 Answers1

0

One potential cause I know of is a Race Condition. If thread A needs something from thread B, but isn't programmed to wait for thread B, then the two threads race to that point in the code. If A gets there before B you get an error. If B gets there before A then nothing seems wrong. The threads will win or lose the race depending on how the kernel schedules them, which is not guaranteed to be the same between runs.

Jared K
  • 241
  • 2
  • 8