Intermittent Exception from IItemManager.fetchCompleteItem
IItemManager.fetchCompleteItem is throwing an intermittent exception. . The code is attempting to lookup a baseline. Given a valid snapshot UUID, the second line sometimes fails. The first line is able to find the handle, but the fetchCompleteItem sometimes fails reporting that the item does not exist. Trying again later with the same UUID later typically works. Is the code below not using the API as it was intended?
IBaselineHandle baselineHandle = (IBaselineHandle) IBaseline.ITEM_TYPE.createItemHandle(UUID.valueOf(baselineUuid), null);
teamRepository.itemManager().fetchCompleteItem(baselineHandle, IItemManager.REFRESH, progressMonitor);
Here is the exception:
com.ibm.team.repository.common.ItemNotFoundException: CRJAZ0215I The following recordwas not found in the database: com.ibm.team.scm.common.internal.impl.BaselineHandleImpl@1dbe1dbe (stateId: null, itemId: [UUID _7iGVEhMXEeK55MckdS-9yw], origin: <unset>, immutable: <unset>)
Are there situations that could cause an item to appear not to exist?
Accepted answer
I see a couple of possibilities:
- If the UUID is for a snapshot, you should be using IBaselineSetHandle, not IBaselineHandle. It's possible that using the wrong type results in inconsistent behaviour, e.g. if the in-memory item caches don't check the item type so it works if the item is in the cache, but fails if reading from the DB (or vice versa).
- You're running with different user ids at different times, and the visibility of the snapshot is such that it's visible to one user but not the other.
Comments
Thanks for the response! I'm going to play around with the code per your suggestion in #1. Regarding #2, we are using the same user ID both for snapshot creation and snapshot lookup, so I think that we can rule that out.
This appears to have addressed the issue. We have not seen the intermittent exception after making this change. We've given it several days of run time so far without issue.
Comments
Kirk Vogen
Oct 22 '12, 10:49 a.m.