Repository navigation
Commit 278fe2f
authored
fix(bigtable): copy Metadata per GetClientConfiguration call (#14950)
### Problem
`ClientConfigurationManager` constructs a single `io.grpc.Metadata`
instance in its constructor and passes that same mutable reference to
`ClientCall.start(listener, metadata)` on every `GetClientConfiguration`
poll and retry. In `grpc-java`, `ClientCall.start()` takes ownership of
the `Metadata` instance, and channel `ClientInterceptor`s wrap
`realChannel` above `RetriableStream` and mutate `headers` in place
before any defensive copy is made. Whenever a channel
`ClientInterceptor` (for example
`MetadataUtils.newAttachHeadersInterceptor` or a tracing interceptor
calling `headers.put(...)` in `start()`) appends per-RPC headers without
`discardAll`, duplicate header entries accumulate on
`ClientConfigurationManager.metadata` every 5 minutes until outbound
header encoding exceeds the server's HTTP/2
`SETTINGS_MAX_HEADER_LIST_SIZE` (`64 KiB`), causing Netty's
`HpackEncoder` to fail every subsequent poll locally with
`Status.INTERNAL: http2 exception` (`HeaderListSizeException`) —
surviving `replaceChannel()` until JVM restart.
### Fix
- Copy `this.metadata` into a fresh `Metadata` instance per `ClientCall`
in `ClientConfigurationManager.sendRequest()`, matching `gax-grpc`'s
`GrpcClientCalls`, `BigtableChannelPrimer`, and `SessionPoolImpl`.
### Testing
- Added
`metadataDoesNotAccumulateAcrossPollsWithHeaderAttachingInterceptor`
verifying 26 consecutive polls against a server advertising
`maxInboundMetadataSize(1024)` with a header-appending
`ClientInterceptor` succeed without header accumulation (`1` copy of
each header per poll on the wire).1 parent 2947dfd commit 278fe2f
2 files changed
Lines changed: 110 additions & 1 deletion
File tree
- java-bigtable/google-cloud-bigtable/src
- main/java/com/google/cloud/bigtable/data/v2/internal/util
- test/java/com/google/cloud/bigtable/data/v2/internal/util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
| |||
392 | 395 | | |
393 | 396 | | |
394 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
395 | 401 | | |
396 | 402 | | |
397 | 403 | | |
| |||
423 | 429 | | |
424 | 430 | | |
425 | 431 | | |
426 | | - | |
| 432 | + | |
427 | 433 | | |
428 | 434 | | |
429 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| 67 | + | |
62 | 68 | | |
| 69 | + | |
63 | 70 | | |
64 | 71 | | |
65 | 72 | | |
| |||
688 | 695 | | |
689 | 696 | | |
690 | 697 | | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
691 | 792 | | |
692 | 793 | | |
693 | 794 | | |
694 | 795 | | |
695 | 796 | | |
696 | 797 | | |
| 798 | + | |
697 | 799 | | |
698 | 800 | | |
699 | 801 | | |
| |||
716 | 818 | | |
717 | 819 | | |
718 | 820 | | |
| 821 | + | |
719 | 822 | | |
720 | 823 | | |
721 | 824 | | |
| |||
0 commit comments