grpc / grpc/grpc-java

Executor usage in `ClientCallImpl` races with channel shutdown and termination.

Đang mở
#1,981 4 bình luận 0 reaction 1 người được giao Được @zhangkun83 nhận Xem trên GitHub
bug
Ngôn ngữ chính
Java
Star
12.1k
Fork
4k
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
37

Mô tả

`ManagedChannelImpl` clear `scheduledExecutor` in `shutdown()`, and releases (which potentially closes) `executor` in `maybeTerminateChannel()`.

Neither `newCall()` nor `ClientCallImpl` checks the shutdown state of the channel. `ClientCallImpl` relies on `FailingClientTransport` for the expected behavior. However, `ClientCallImpl` uses the passed in executors anyway, for scheduling the deadline timer and invoking the call listener.

If `ClientCallImpl` tries to schedule a deadline timer after the channel is shut down, it will get a NPE. If it runs the call listener after the shared executor has been closed, which is 1 second (`SharedResourceHolder.DESTROY_DELAY_SECONDS`) after all references are gone, e.g., the application calls `Call.start()` that late, it will get a `RejectedExecutionException`. Our current tests are not testing for the two cases.

This doesn't seem to be a serious issue. It only affect people who try to use `Call`s after the channel has been shutdown. I am yet to figure out a solution.

Anyway, it seems `executor` should be cleared after being returned to the shared pool, like `scheduledExecutor`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.