xapi-project/xen-api — pull request #1719 by djs55 (2014-04-30 16:59:41+00:00)
Title: Fix races in event.from and add a test case

- CloudStack uses 1 session and multiple threads, each calling event.from. Unfortunately each thread shared state on the server, causing some of these threads to spuriously fail with SESSION_INVALID (triggering task cleanup and cascading errors).
- CloudStack expects an empty event set to signify an error. Unfortunately a badly-timed Modify followed by a Delete could cause this to happen

The new test case captures the first failure triggered by CloudStack. It fails without the fix and passes afterwards.

This code needs some careful review from @jonludlam