bugs on weak memory model arch.(arm/power)
- Dominant language
- C++
- Stars
- 2.1k
- Forks
- 650
- PR merge metrics
- No merged PRs in 30d
Description
`RpcMessageStream::try_start_send()` [1](https://github.com/baidu/sofa-pbrpc/blob/32e79652c0ababceee35425fbd1922117a28d396/src/sofa/pbrpc/rpc_message_stream.h#L501)can miss pending messages because it first performs a relaxed load of `_send_token` which can miss store/store_release of `_send_token`.
`RpcMessageStream::get_from_pending_queue()` [2](https://github.com/baidu/sofa-pbrpc/blob/32e79652c0ababceee35425fbd1922117a28d396/src/sofa/pbrpc/rpc_message_stream.h#L407)can miss pending messages because it performs a relaxed load of `_pending_message_count` before entering the critical section guarded by _pending_lock, again, the relaxed load can miss store/store_release of `_pending_message_count`.
With the above two defects combined, the current message calling `try_start_send()` and the previous message calling `get_from_pending_queue()` (on_write_some() ---> try_start_send() ---> get_from_pending_queue() ) both may miss the chance to send the current pending message, which lead to the current pending message siting idle in `_pending_calls`until timeout.
I believe the scenario described above is quite likely to happen under weak memory model such as aarch64 and ppc64.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/sofa/pbrpc/rpc_message_stream.h at RpcMessageStream::get_from_pending_queue() and try_start_send(), then trace the on_write_some() to try_start_send() to get_from_pending_queue() path. Review the relaxed loads and corresponding _send_token and _pending_message_count stores for weak-memory behavior on aarch64 and ppc64. Done means pending messages are not left idle until timeout because these operations miss updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100