Skip to content

framework/csimanager: fix/improve error handling and resource management#7174

Open
rajat-samsung wants to merge 1 commit intoSamsung:masterfrom
rajat-samsung:fix/csifw_error_handling_and_resourse_management
Open

framework/csimanager: fix/improve error handling and resource management#7174
rajat-samsung wants to merge 1 commit intoSamsung:masterfrom
rajat-samsung:fix/csifw_error_handling_and_resourse_management

Conversation

@rajat-samsung
Copy link
Copy Markdown
Contributor

@rajat-samsung rajat-samsung commented Feb 27, 2026

This commit enhances the Channel State Information (CSI) framework with improved error handling, resource management, and robustness:

  • 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
  • Added consecutive failure detection mechanism to prevent system lockups
  • Fixed preprocessor directive logic for custom device path configuration
  • Fixed logic error in add_service function for proper buffer management
  • Improved resource management with proper pthread attribute cleanup
  • Added configurable timeout option for CSI data collection
  • Removed invalid csi config enable after wifi reconnect
  • Added task_manager stop and unregister

@rajat-samsung rajat-samsung force-pushed the fix/csifw_error_handling_and_resourse_management branch 2 times, most recently from e80da5b to e2241df Compare March 9, 2026 07:46
@rajat-samsung rajat-samsung force-pushed the fix/csifw_error_handling_and_resourse_management branch 3 times, most recently from 4e1c5a3 to 9e96c9f Compare April 20, 2026 08:16
return;
}

if (info->status == TM_APP_STATE_RUNNING) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSIFW_LOGD("CSI Data read complete %llu", get_monotonic_time_us());

return CSIFW_OK;
}

static unsigned long long get_monotonic_time_us(void)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@rajat-samsung rajat-samsung force-pushed the fix/csifw_error_handling_and_resourse_management branch from 9e96c9f to dd96d56 Compare April 21, 2026 10:17
- Renamed CSIFW_INVALID_RAWDATA to CSIFW_ERROR_DATA_NOT_AVAILABLE for clearer error reporting
- Fixed logic error in add_service function for proper buffer management
- Implemented timeout handling in message queue operations to prevent indefinite blocking
- 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
- Fixed preprocessor directive logic for custom device path configuration
- Enhanced error reporting with more descriptive messages and callback notifications
- Removed invalid csi config enable after wifi reconnect
- Added task_manager stop and unregister
@rajat-samsung rajat-samsung force-pushed the fix/csifw_error_handling_and_resourse_management branch from dd96d56 to 702fd2a Compare April 22, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants