(Regression?) g_assert_cmp*() ignores value of G_DISABLE_ASSERT
We got a crash report where an assertion failed in libnice, which I'm reporting in this issue. In this one I'd like to raise the problem of not being able to fully disable assertions in libnice. This is caused by the change from g_assert
to g_assert_cmp*
in commit 1da0537b.
The problem comes from g_assert_cmp*
family of functions being meant for unit testing, and as such they cannot be suppressed with G_DISABLE_ASSERT
. I found a bit more context in this GLib issue:
However I see why this was added. Being able to see the expected vs. actual value that caused the assert is a valuable information that users weren't able to provide with the old g_assert
, thus the constant requests to please edit libnice code to do a bit of printf-based debugging.
My suggestion here is to keep using the new functions, but wrap them behind a libnice macro that does check if G_DISABLE_ASSERT
is defined. Nothing too fancy, some libnice_assert_cmp*
just like what is done in GLib. Would you be open to such a change? (If yes, would you rather have a look at it, or an MR is ok?)
Side note about why I want to disable assertions (related: #98 (closed))
The camp seems to be divided in two groups here, but I think the option should be given to choose between the "fail fast and noisily" model, and the "do as much as you can without failing". I'm on the latter, because using assertions in 3rd-party code doesn't allow me to own my product's crashes.
In this case, just an example: a mere discrepancy in the state of a single candidate (here) making the whole server fall, during an end user conference with potentially hundreds of users, is not very nice of me (towards them). I'd rather fail the offending user's connection, thus the very first thing I need is to disable such assertions. Hopefully my position is sensible.