I've encountered some strange cache rebuilding problems with Entity API modules like Field collections, Profile2, Message and OG. At the end of the cache rebuilt some information (e.g. Profile2 bundle related info) was missing, which is caused by some entity_info_alter hooks that use some other API functions that are based on entity info, although the entity info isn't completely rebuilt yet.
One concrete scenario is described in the EVA issue queue (), but I will close the issue there, as it should be fixed in the Entity API.
In order to solve the problem, the way bundles are added to the entity info needs to be re-worked. It should be avoided that API functions with dependencies to entity info are ever used in such a hook.
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_cache_profile2.patch. Unable to apply patch. See the log in the details link for more information. View
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_cache_og.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View
PASSED: [[SimpleTest]]: [MySQL] 327 pass(es). View