[llvm-dev] Purpose of Epoch Trackers
Eli Friedman via llvm-dev
llvm-dev at lists.llvm.org
Fri Jun 21 11:01:26 PDT 2019
Epoch tracking is meant to catch cases where an iterator might point to an invalid address due to another operation on the same DenseMap, on the same thread. For example, if you have a for loop that iterates over a DenseMap, and insert an element into that DenseMap inside the loop body.
Neither DenseMap nor the epoch tracking is threadsafe; if it’s catching a race condition, you’re getting lucky.
From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Praveen Velliengiri via llvm-dev
Sent: Friday, June 21, 2019 6:27 AM
To: llvm-dev <llvm-dev at lists.llvm.org>
Subject: [EXT] [llvm-dev] Purpose of Epoch Trackers
I'm dealing with the multi-threaded code, in one of executions of the program I hitting an assertion failure, I'm not always getting the assertion failure when I run the executable but it occurs for say (1 in 10) times. I think there may be an thread race condition. I don't know which is the root cause of this error because the assertion not explicitly occurs in my code, it occurs in the library code which I'm using in my threads.
Assertion I'm getting is this:
Global Value is CRO: /home/preejackie/spicy/orcs/llvm/include/llvm/ADT/DenseMap.h:1242: bool llvm::DenseMapIterator<const llvm::Value *, llvm::StringMapEntry<llvm::Value *> *, llvm::DenseMapInfo<const llvm::Value *>, llvm::detail::DenseMapPair<const llvm::Value *, llvm::StringMapEntry<llvm::Value *> *>, false>::operator!=(const llvm::DenseMapIterator::ConstIterator &) const [KeyT = const llvm::Value *, ValueT = llvm::StringMapEntry<llvm::Value *> *, KeyInfoT = llvm::DenseMapInfo<const llvm::Value *>, Bucket = llvm::detail::DenseMapPair<const llvm::Value *, llvm::StringMapEntry<llvm::Value *> *>, IsConst = false]: Assertion `(!Ptr || isHandleInSync()) && "handle not in sync!"' failed.
It seems like the given assertion is defined in Epochtracker.h only for the debug build. My question is what is the purpose of Epochtrackers,h? Is it there to catch the race condition when accessing the densemap concurrently ?
Please tell me if you need more info
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev