abseil / abseil/abseil-cpp

Inconsistency between find and traversing with iterators

Aberta
#1,193 7 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C++
Estrelas
18.1k
Forks
3.2k
Merge médio
20h 36min
PRs com merge (30d)
1

Descrição

Hi all;
I recently replaced the hash tables in my code with abseil hash. I notice the following abnormal behavior in some of my tests. I look up for an element with find and it is saying is not there then I print all key values in the container and I see the element being actually present.

```
typedef absl::flat_hash_map
, absl::container_internal::hash_default_eq
, Allocator> // Our own Allocator
> map_t;

auto hit = hashIndexA.map.find(hashCode);
if (hit == hashIndexA.map.end()) {
cout<<&hashIndexA<<&(hashIndexA.map)<<"::element not found:"<first<<"::"<second<<"\n";
}

sample output:
0xffff62a2d0d00xffff62a2d128::element not found:-1574725910
HASHINDEX:-1574725910::2
HASHINDEX:-1574733349::5
```

This is with C++11, Abseil-lts_2020_09_23 and the only maybe special thing here is that the map is created in one thread and potentially read in a separate thread . There is no concurrent access. The table is completely created by one thread and later on the other thread is is reading the data.

Maybe by luck , when replacing the default hashing function with std::hash my tests are passing.
Also the tests always pass in debug mode. The issue is only present in -g -O2 mode.

I was wondering if anybody else hit this issue in the past and if there are any flags that can be set ?

Are there any thread local storage issues that may affect the behavior in my scenario ?

Unfortunately I don;t have an individual reproducer. For me these are hundred of complex tests doing joins, distinct, group by in the context of a database.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.