http://qs321.pair.com?node_id=624625

ropey has asked for the wisdom of the Perl Monks concerning the following question:

Recently a race condition was found in a application I am responsible for, this application actually is a custom XML RPC engine... what happens is 2 exact requests come in at same time, the first one comes back with the correct response, the second one throws a error.

The reason for the error is simply not using transactions in the DB so they are both trying to update at same time and its failing, this I know how to fix... but my question is how do I add test cases for it

Reason I ask that is my test suite is a series of sequential tests, ok(x);ok(y); etc - however to simulate this I need to find a way of effectively simulating the race condition within the test script so thus firing off the same time almost in parallel... but whats the best way of doing this ? I could use fork but that does seem overkill in a test script... I could ignore testing this scenario... but seeing as the tests I have written are my best friend I am sure there must be a better way ? any ideas welcome...