You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@brpc.apache.org by "zhaojinzhou (via GitHub)" <gi...@apache.org> on 2025/08/24 09:46:00 UTC
[I] flatmap operator= 导致死锁 (brpc)
zhaojinzhou opened a new issue, #3070:
URL: https://github.com/apache/brpc/issues/3070
**Describe the bug**
<img width="2878" height="488" alt="Image" src="https://github.com/user-attachments/assets/8e310e46-7972-44ef-9560-730597647c3f" />
**To Reproduce**
暂时无法复现。
运行时 偶发死锁,并且一直死循环在这个函数中。
很旧版本的brpc 无此问题。
**Expected behavior**
**Versions**
OS: ubuntu 20.04
Compiler: g++ 8.4
brpc: 1.13.0
protobuf: 3.6.9
**Additional context/screenshots**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org
Re: [I] flatmap operator= 导致死锁 (brpc)
Posted by "zhaojinzhou (via GitHub)" <gi...@apache.org>.
zhaojinzhou closed issue #3070: flatmap operator= 导致死锁
URL: https://github.com/apache/brpc/issues/3070
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org
Re: [I] flatmap operator= 导致死锁 (brpc)
Posted by "zhaojinzhou (via GitHub)" <gi...@apache.org>.
zhaojinzhou closed issue #3070: flatmap operator= 导致死锁
URL: https://github.com/apache/brpc/issues/3070
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org
Re: [I] flatmap operator= 导致死锁 (brpc)
Posted by "zhaojinzhou (via GitHub)" <gi...@apache.org>.
zhaojinzhou commented on issue #3070:
URL: https://github.com/apache/brpc/issues/3070#issuecomment-3218073531
!!! 实锤,以下代码 会死锁。 碰到赋值语句,立刻死锁。 希望尽早修复
#include <iostream>
#include <vector>
#include <atomic>
#include <memory>
#include <random>
inline uint64_t find_power2(uint64_t b) {
b -= 1;
b |= (b >> 1);
b |= (b >> 2);
b |= (b >> 4);
b |= (b >> 8);
b |= (b >> 16);
b |= (b >> 32);
return b + 1;
}
inline size_t flatmap_round(size_t nbucket) {
#ifdef FLAT_MAP_ROUND_BUCKET_BY_USE_NEXT_PRIME
return find_next_prime(nbucket);
#else
// the lowerbound fixes the corner case of nbucket=0 which results in coredump during seeking the map.
return nbucket <= 8 ? 8 : find_power2(nbucket);
#endif
}
static bool is_too_crowded(size_t size, size_t nbucket, uint32_t load_factor) {
return size * 100 >= nbucket * load_factor;
}
int main() {
size_t new_nbucket =16;
size_t size = 14;
do {
new_nbucket = flatmap_round(16);
static int i=0;
i++;
if (i % 1000 == 0) {
std::cout << "new_buckets_and_thumbnail: ";
}
} while (is_too_crowded(size, new_nbucket, 80));
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org