Skip to content

Gateway Scheduled Poll Intermittent Stall #1

@qiweimao

Description

@qiweimao

Observed Behavior:

================================
Beginning Schedule: 2, lastPoll: 26657437, interval: 60000, currentTime: 26717448
E (26723301) myAPP: i2cWriteReadNonStop returned Error 263

Source Code Snippet

Serial.println();
Serial.println("================================");
Serial.print("Beginning Schedule: ");
Serial.print(i);
Serial.print(", lastPoll: ");
Serial.print(lastPoll);
Serial.print(", interval: ");
Serial.print(interval);
Serial.print(", currentTime: ");
Serial.println(currentTime);

logErrorToSPIFFS("Scheduled Poll: ");
logErrorToSPIFFS(String(i));

lora_config.schedules[i].lastPoll = currentTime;
for (int j = 0; j < peerCount; j++) {
  rej_switch = 0; // Turn on file transfer

  if (xSemaphoreTake(xMutex_DataPoll, 1000 / portTICK_PERIOD_MS) == pdTRUE) {
    poll_success = false;
    func(j);
    if (!xSemaphoreGive(xMutex_DataPoll)) {
      Serial.println("Error: Failed to release xMutex_DataPoll");
      logErrorToSPIFFS("Error: Schedule: ");
      logErrorToSPIFFS(String(i));
      logErrorToSPIFFS("Error: Failed to release xMutex_DataPoll");

      // Attempt recovery actions, such as reinitializing resources
      // This example just logs the attempt; real recovery logic would be more complex
      vSemaphoreDelete(xMutex_DataPoll);
      Serial.println("Deleted xMutex_DataPoll");
      xMutex_DataPoll = xSemaphoreCreateMutex();
      Serial.println("Recreated xMutex_DataPoll");
      if (xMutex_DataPoll == NULL) {
        Serial.println("Error: Failed to reinitialize xMutex_DataPoll");
        logErrorToSPIFFS("Error: Failed to reinitialize xMutex_DataPoll");
        ESP.restart();  // Reset the system as a last resort
      }
    }
  } else {
    Serial.println("Error: Failed to obtain xMutex_DataPoll");
  }

Possible Related Issue:
Espressif Arduino-ESP32 Issue #8056

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions