logging: optional details for ASSERT#3934
Conversation
mattklein123
left a comment
There was a problem hiding this comment.
FWIW, this seems a bit less worth it to me than with RELEASE_ASSERT, since in many cases I think these types of assets are pretty obvious. Do we want to make this required? What's the thinking here?
|
internal bug: "assert failure: !connection_stats_" |
|
What about for the debug ASSERT making the string optional but not requiring it? WDYT? |
|
Sure, given we're already passing X into a submacro so don't have the early evaluation problem, I can do and resurect my vararg magic I rejected from the RELEASE_ASSERT PR. Probably tomorrow though :-) |
|
If it's easier you could also just do VERBOSE_ASSERT() or something like that. Whatever is easiest. |
|
I'm not sure if we should do this by default. ASSERTs are intended to be lightweight self-documenting statements of invariants, so I would prefer we kept them by default lightweight. A VERBOSE_ASSERT is better IMHO for opt-in logging. |
|
@alyssawilk that specific example is a place we should just have better config validation. So, I don't think the right fix is to patch up the ASSERT there. |
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
|
@htuch I already agreed to make it optional, just ended up out yesterday so didn't get it shipped. |
|
@alyssawilk yeah, I see. I think |
|
|
||
| void ConnectionImpl::setConnectionStats(const ConnectionStats& stats) { | ||
| ASSERT(!connection_stats_); | ||
| ASSERT(!connection_stats_, "Perhaps there are duplicate filters in your configuration?"); |
There was a problem hiding this comment.
Maybe this is what @htuch was asking about, but from a quick glance this seems non-obvious to me. How is this assert hit if there are duplicate filters?
There was a problem hiding this comment.
If you configure 2 http connection manager filters, each one has initialzeReadFitlerCallbacks called on it and calls setConnectionStats. The second setConnectionStats causes an assert fail.
As htuch@ says the real fix is to detect the broken config on start-up but if two filters both setConnectionStats it's nicer IMO to get an explanation than just an assert fail.
|
ditto 2 tcp filters in a row. I guess if you had a tcp and an hcm it would as well, so I could try for a more clear explanation that 2 filters are both trying to own the connection stats and it's some sort of borked filter chain. |
Yeah if you are willing to try for a more fleshed out comment that would be helpful. |
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
mattklein123
left a comment
There was a problem hiding this comment.
Thanks for the updated comment!
Allowing ASSERT to optionally use the details added to RELEASE_ASSERT in #3842
Risk Level: Low
Testing: bazel //test/..., unit tests of new and old behavior.
Docs Changes: n/a
Release Notes: n/a