framework/csimanager: fix/improve error handling and resource management#7174
Merged
vibhor-m merged 1 commit intoSamsung:masterfrom Apr 27, 2026
Conversation
e80da5b to
e2241df
Compare
4e1c5a3 to
9e96c9f
Compare
vibhor-m
reviewed
Apr 21, 2026
| return; | ||
| } | ||
|
|
||
| if (info->status == TM_APP_STATE_RUNNING) { |
Contributor
There was a problem hiding this comment.
This condition does not ensure, that stop will be called only when task_func is running. Hence running check can be removed.
| csi_data_len = msg.data_len; | ||
| len = readCSIData(fd, get_data_buffptr, csi_data_len); | ||
| last_data_read_timestamp_us = get_monotonic_time_us(); | ||
| CSIFW_LOGD("last_data_read_timestamp_us after readCSIData:%llu",last_data_read_timestamp_us); |
Contributor
There was a problem hiding this comment.
CSIFW_LOGD("CSI Data read complete %llu", get_monotonic_time_us());
| return CSIFW_OK; | ||
| } | ||
|
|
||
| static unsigned long long get_monotonic_time_us(void) |
Contributor
There was a problem hiding this comment.
This function will be called lot of times.
this function should be inline
OR
This function can be a pre-processer
| consecutive_failures++; | ||
| if (consecutive_failures >= MAX_CONSECUTIVE_FAILURES) { | ||
| CSIFW_LOGE("CRITICAL: %d consecutive Message received size error", consecutive_failures); | ||
| consecutive_failures = 0; |
Contributor
There was a problem hiding this comment.
consecutive_failures & timeout_count are in success path and will be set to 0 always. This may be a redundant operation performed in default path
129f3e7 to
ceade1c
Compare
vibhor-m
reviewed
Apr 27, 2026
| } | ||
| if (len != csi_data_len - CSIFW_CSI_HEADER_LEN) { | ||
| csi_data_len = len + CSIFW_CSI_HEADER_LEN; | ||
| if (consecutive_failures > 0) { |
Contributor
There was a problem hiding this comment.
condition can be improvised as per timeout_count variable
| if (consecutive_failures >= MAX_CONSECUTIVE_FAILURES) { | ||
| CSIFW_LOGE("CRITICAL: %d consecutive failures detected", consecutive_failures); | ||
| consecutive_failures = 0; | ||
| p_csifw_ctx->CSI_DataCallback(CSIFW_INTERNAL_ERROR, 0, NULL, 0); |
Contributor
There was a problem hiding this comment.
add a todo to stop CSI FW when this error happens
- Renamed CSIFW_INVALID_RAWDATA to CSIFW_ERROR_DATA_NOT_AVAILABLE for clearer error reporting - Implemented timeout handling in message queue operations to prevent indefinite blocking - Enhanced error reporting with more descriptive messages and callback notifications - Fixed preprocessor directive logic for custom device path configuration - Fixed logic error in add_service function for proper buffer management - Added consecutive failure detection mechanism to prevent system lockups - Improved resource management with proper pthread attribute cleanup - Added configurable timeout option for CSI data collection - Removed invalid csi config enable after wifi reconnect - CSI data length correction using board info - Added task_manager stop and unregister
ceade1c to
c7a2639
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit enhances the Channel State Information (CSI) framework with improved error handling, resource management, and robustness: