binder: Inbound.java reassembly logic needlessly handles out-of-order transactions, fails to handle silently dropped ones.
- Dominant language
- Java
- Stars
- 12.1k
- Forks
- 4k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 37
Description
[Inbound](https://github.com/grpc/grpc-java/blob/master/binder/src/main/java/io/grpc/binder/internal/Inbound.java) has code to handle Binder transactions delivered out-of-order, something that can't happen (see [IBinder#FLAG_ONEWAY](https://developer.android.com/reference/android/os/IBinder#flag_oneway)). At the same time, it fails to handle the rare case where transactions are [silently dropped](http://g/android-chatty-eng/c/9iA4FIVKeBs/m/wyxJFGuMBAAJ).
We should simplify the message reassembly code and fail fast on gaps instead of waiting forever for a transaction that will never come. If an incoming transaction index doesn't have the next expected value, immediately close the stream (with `DATA_LOSS`? `UNAVAILABLE`?). This avoids a hang, allowing callers to retry sooner.
Contributor guide
Assessment
This issue has not been assessed yet.