Praveen Velliengiri via llvm-dev
2019-Jun-21 13:27 UTC
[llvm-dev] Purpose of Epoch Trackers
Hi all, 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 Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190621/cdffbffa/attachment.html>
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. -Eli 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 Hi all, 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 Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190621/32e5e2d5/attachment.html>
Praveen Velliengiri via llvm-dev
2019-Jun-21 21:10 UTC
[llvm-dev] Purpose of Epoch Trackers
Oh, then I think it may results from accessing / mutating data from different threads with different timed sequences of events. But I'm not sure which part in my code triggers this behaviour. I will do more investigation tomorrow and let you know Thanks On Fri, 21 Jun 2019 at 23:31, Eli Friedman <efriedma at quicinc.com> wrote:> 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. > > > > -Eli > > > > *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 > > > > Hi all, > > 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 > > Thanks >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190622/6af1a106/attachment.html>