awslabs / amazon-kinesis-video-streams-pic

Apache License 2.0
49 stars 51 forks source link

Assert handle #239

Closed disa6302 closed 9 months ago

disa6302 commented 9 months ago

Issue #, if available:

Description of changes:

In release build, assert() instruction is not executed. Since the SDK has APIs like CHECK and CHECK_EXT which invoke assert on FATAL conditions, there is a need for a custom assert operation that achieves the same purpose as assert in C language. assert in release build is still not desirable, and we should convert to graceful handling, this PR attempts to fix the current gap in release build to avoid catastrophic segfaults and instead terminate with some information.

Testing:

In debug build:

2024-01-18 21:45:45.054 DEBUG   setRequestHeader(): Appending header to request: user-agent -> AWS-PRODUCER-SDK-KVS/1.5.1 Clang/15.0.0 Darwin/23.2.0 arm64
Assertion failed: (0), function createStreamCurlHandler, file CurlApiCallbacks.c, line 1092.
zsh: abort      ./kvsVideoOnlyRealtimeStreamingSample test194849-280225

In release build:

2024-01-18 21:49:23.366 DEBUG   defaultStreamStateTransitionHook(): Stream state machine retry count: 0
2024-01-18 21:49:23.366 DEBUG   defaultStreamStateTransitionHook():
 KinesisVideoStream base result is [404]. Executing KVS retry handler of retry strategy type [1]
2024-01-18 21:49:23.366 DEBUG   setRequestHeader(): Appending header to request: user-agent -> AWS-PRODUCER-SDK-KVS/1.5.1 Clang/15.0.0 Darwin/23.2.0 arm64
Assertion failed in file /amazon-kinesis-video-streams-producer-c/src/source/CurlApiCallbacks.c, function createStreamCurlHandler, line 1091
zsh: abort      ./kvsVideoOnlyRealtimeStreamingSample test194849-280225

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

codecov-commenter commented 9 months ago

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (792e0db) 80.42% compared to head (705865c) 80.37%.

:exclamation: Current head 705865c differs from pull request most recent head b4c56cb. Consider uploading reports for the commit b4c56cb to get more accurate results

Files Patch % Lines
src/utils/src/CustomAssert.c 0.00% 4 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #239 +/- ## =========================================== - Coverage 80.42% 80.37% -0.05% =========================================== Files 52 53 +1 Lines 10762 10750 -12 =========================================== - Hits 8655 8640 -15 - Misses 2107 2110 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.