The BufferCache.invalidateIfFileIdMatch() could have some race condition due to
read/write is not in synchronized block.
Alex proposed this fix (so far it works in hyracks_giraph branch):
private boolean invalidateIfFileIdMatch(int fileId, CachedPage cPage, boolean
flushDirty)
throws HyracksDataException {
if (BufferedFileHandle.getFileId(cPage.dpid) == fileId) {
if (cPage.dirty.get()) {
if (flushDirty) {
write(cPage);
}
cPage.dirty.set(false);
int newPinCount = cPage.pinCount.decrementAndGet();
if (newPinCount != 0) {
throw new IllegalStateException("Page is pinned and file is being closed");
}
} else {
if (cPage.pinCount.get() != 0) {
throw new IllegalStateException("Page is pinned and file is being closed");
}
}
cPage.invalidate();
return true;
}
return false;
}
Original issue reported on code.google.com by buyingyi@gmail.com on 15 Nov 2011 at 11:09
Original issue reported on code.google.com by
buyingyi@gmail.com
on 15 Nov 2011 at 11:09