Are you saying that race conditions are in general impossible
to prove/disprove, or just that my code isn't the way to do it? Heh.
Proving them can be easy, but in general they're hard to disprove.
To reliably reproduce a race condition, you generally need to try and
force threads/processes into specific execution orders. Usually, that's
put in the too hard basket, and you just swamp the thing with requests
and hope that all the permutations get covered (as your code has done).
If you want to test away race conditions, you have to simulate multiple
requests in linear fashion. Usually I just draw great big flow-charts of
the code on paper and try and think out what would go wrong if x
happened before y. I've occasionally performed manual testing in java by
setting breakpoints in the debugger to pause all the threads and step
different threads through in different orders. This doesn't prove
anything with certainty, but it usually gets my brain working the right
way to see the edge-cases where things could go wrong.
To completely disprove race conditions, you need to test each and every
possible permutation of thread execution. Depending on the structure of
your code this may not be possible (or usually, just not practical) to
do in a manual or automated fashion.
ยทยทยท
#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################