chenBright commented on code in PR #3421:
URL: https://github.com/apache/brpc/pull/3421#discussion_r3726841879
##########
src/brpc/span.cpp:
##########
@@ -581,13 +586,13 @@ inline int GetSpanDB(butil::intrusive_ptr<SpanDB>* db) {
}
void Span::Submit(std::shared_ptr<Span> span, int64_t cpuwide_time_us) {
- // Only submit spans without a local parent (i.e., server spans).
- // Server spans hold shared_ptr references to their child spans (via
_client_list),
- // ensuring child spans remain alive until the server span is submitted
and dumped.
- // Client spans are not submitted here because their lifetime is managed
by their
- // parent server span.
+ // Submit root spans without a local parent. Server spans and root client
+ // spans are submitted independently; child client spans with a live local
+ // parent are serialized under the parent to avoid duplicate submissions.
if (span->local_parent().expired()) {
- span->submit(cpuwide_time_us);
+ if (span->TryMarkSubmitted()) {
Review Comment:
```c++
if (span->local_parent().expired() && span->TryMarkSubmitted()) {
span->submit(cpuwide_time_us);
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]