grpc / grpc/grpc-java

Revisit the threading and ordering guarantees of StreamTracer

Open
#3,489 1 comment 0 reactions 1 assignee Assigned to @zhangkun83 View on GitHub
enhancement
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

Currently `StreamTracer` must be thread-safe, as gRPC doesn't guarantee synchronized invocation for it. While the entire class can't be marked as not-thread-safe, as `inboundUncompressedSize()` may be called from a different thread (app thread) from `inboundMessage()` (network thread), some methods are called sequentially, e.g., `inboundMessage()` and `outboundMessage()`. If a tracer implementation only cares about `inboundMessage()`, it may be totally safe to not to synchronize. We need to find a way to relax the thread-safety requirement to make it easier to implement.

We also need a better definition on the ordering of the methods, e.g., is it possible for `inboundMessage()` to happen after `streamClosed()`?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.