Environment
- clang+llvm version 15.0.7/16.0.0
During evaluation we compile the source code on testbed for simplicity (also try to test compatibility), but found Clang+LLVM v16.0.0 cannot compile our repo. No further consideration conducted (seems related to stdlib), but rollback to v15 helped.
- buildifier
Configuring buildifier under CLion requires careful previlege consideration. Otherwise the agent cannot access the binary installed through Golang’s package management mechanism.
- proto_format with
.proto
file relocation
I found a bug from official repo’s CI tool, which extract the latest git commit log but cannot parse the relocation record, only add/remove were suppprted. Fixing is easy, just extract the extra input from a relocation record. But localizing this issue from bazel’s output took some time as the Bazel targets are heavily nested in Envoy.
Build Related
- Visibility in bazel
I expose some access to xDSApiHandle to our additional management modules so that it can affect envoy’s configuration upon certain rules or receiving updates. This requires corresponding visibility exposure in the BUILD file of such handle libraries. Simply adding the bazel target as a reference won’t compile, although CLion can recognize it.
C++ Related
- thread safety
thread_local_dispatcher with Timer: Envoy wraps the timer with thread safety checker. Remember to pass a thread_local_dispatcher reference to the classes using timer, to create a local one.
- string constructor
string{string_view.data()}
v.s. string{string_view}
: the former won’t have a reading barrier and will load certain prefix + some unwanted data into the new string.
- shared pointer
For parent class enabling shared_from_this to expose abstract pointer, and have multiple subclass layers, public inheritance throughout the path is required, otherwise it would compile but throw a bad_weak_ptr when running.
- async socket debugging
It will directly return a NOT_READY error after sent packet, don’t be misled by this error.
Below are stupid bugs
HeaderMap.get() v.s. HeaderMap.getByKey() have different semantics and the former doesn’t return a value.
unique_ptr moved twice