Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aarch64架构下运行unittest报错 #2318

Closed
leaf-potato opened this issue Jul 16, 2023 · 4 comments
Closed

aarch64架构下运行unittest报错 #2318

leaf-potato opened this issue Jul 16, 2023 · 4 comments

Comments

@leaf-potato
Copy link
Contributor

leaf-potato commented Jul 16, 2023

Describe the bug (描述bug)
在aarch64架构下运行brpc_grpc_protocol_unittest报错bthread=4294968320 sched_to itself!并异常退出,具体日志信息如下:

[==========] Running 7 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 7 tests from GrpcTest
[ RUN      ] GrpcTest.percent_encode
I0716 16:53:28.192583 1732065 /home/leaf-potato/Open-Source/brpc/src/brpc/server.cpp:1127] Server[(anonymous namespace)::MyGrpcService] is serving on port=8011.
I0716 16:53:28.337017 1732065 /home/leaf-potato/Open-Source/brpc/src/brpc/server.cpp:1130] Check out http://dev-ubuntu:8011 in web browser.
I0716 16:53:28.337832 1732065 /home/leaf-potato/Open-Source/brpc/src/brpc/server.cpp:1187] Server[(anonymous namespace)::MyGrpcService] is going to quit
F0716 16:53:28.338519 1732076 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:623] bthread=4294968320 sched_to itself!
[       OK ] GrpcTest.percent_encode (177 ms)
[ RUN      ] GrpcTest.percent_decode
[2]    1732065 abort      ./brpc_grpc_protocol_unittest 

To Reproduce (复现方法)

  1. 拉取master版本最新代码&安装依赖
  2. mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make

Expected behavior (期望行为)
正常运行单元测试

Versions (各种版本)
OS: Ubuntu 22.04 | aarch64
Compiler: g++ 11.3.0
brpc: master | 2729272
protobuf: 3.12.4

Additional context/screenshots (更多上下文/截图)

@leaf-potato
Copy link
Contributor Author

其他UT也有类似问题 ,brpc_ssl_unittest`运行错误:

[==========] Running 5 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 5 tests from SSLTest
[ RUN      ] SSLTest.sanity
W0716 17:00:42.435997 1733130 /home/leaf-potato/Open-Source/brpc/src/brpc/server.cpp:1968] Duplicate certificate hostname=cert1
W0716 17:00:42.436084 1733130 /home/leaf-potato/Open-Source/brpc/src/brpc/server.cpp:1968] Duplicate certificate hostname=cert1
I0716 17:00:42.442796 1733130 /home/leaf-potato/Open-Source/brpc/src/brpc/server.cpp:1127] Server[EchoServiceImpl] is serving on port=8613.
I0716 17:00:42.599956 1733130 /home/leaf-potato/Open-Source/brpc/src/brpc/server.cpp:1130] Check out http://dev-ubuntu:8613 in web browser.
F0716 17:00:42.608247 1733141 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(1) call sched_to(0xaaaad7326d80)
I0716 17:00:42.608291 1733136 /home/leaf-potato/Open-Source/brpc/src/bthread/fd.cpp:330] Use DEL+ADD instead of EPOLLONESHOT+MOD due to kernel bug. Performance will be much lower.
F0716 17:00:42.609952 1733141 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(1) call sched_to(0xaaaad7326d80)
F0716 17:00:42.614055 1733141 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(1) call sched_to(0xaaaad7326d80)
F0716 17:00:42.615524 1733137 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(1) call sched_to(0xaaaad7326780)
F0716 17:00:42.615918 1733140 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(1) call sched_to(0xaaaad7326c00)
F0716 17:00:42.617769 1733135 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(1) call sched_to(0xaaaad7326480)
F0716 17:00:42.618183 1733138 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(1) call sched_to(0xaaaad7326900)
F0716 17:00:42.618773 1733139 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(1) call sched_to(0xaaaad7326a80)
F0716 17:00:42.619078 1733139 /home/leaf-potato/Open-Source/brpc/src/bthread/task_group.cpp:574] Recursively(2) call sched_to(0xaaaad7326a80)

相同的版本使用clang编译后运行没有问题,比较奇怪。不知道跟之前这个#845 问题是否类似

@wwbmmm
Copy link
Contributor

wwbmmm commented Jul 18, 2023

clang没有问题可能是因为这里走了不同的分支
https://github.com/apache/brpc/blob/master/src/butil/thread_local.h#L49
试试改下这里让gcc+aarch64也走上面的分支呢

@leaf-potato
Copy link
Contributor Author

https://github.com/apache/brpc/blob/master/src/butil/thread_local.h#L49
试试改下这里让gcc+aarch64也走上面的分支呢

改了后单测可以过了,这是啥原因呀?方便讲下嘛

@Huixxi
Copy link
Contributor

Huixxi commented Jul 25, 2023

应该就是编译器的volatile thread local access这个优化在aarch64下有问题,需要关闭了才能正常执行。

@Huixxi Huixxi closed this as completed Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants