Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/ocre/components/container_supervisor/cs_sm_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,23 @@ static void container_thread_entry(void *args) {
// Set TLS for the container's WASM module
current_module_tls = &module_inst;
#endif
// Run the WASM main function
bool success = wasm_application_execute_main(module_inst, 0, NULL);

// Run the WASM main function with exception handling
bool success = false;
const char *exception = NULL;

// Clear any previous exceptions
wasm_runtime_clear_exception(module_inst);

// Execute main function
success = wasm_application_execute_main(module_inst, 0, NULL);

// Check for exceptions
exception = wasm_runtime_get_exception(module_inst);
if (exception) {
LOG_ERR("Container %d exception: %s", container->container_ID, exception);
success = false;
}
// Update container status
if (container->container_runtime_status != CONTAINER_STATUS_STOPPED)
container->container_runtime_status = success ? CONTAINER_STATUS_STOPPED : CONTAINER_STATUS_ERROR;
Expand Down Expand Up @@ -161,7 +176,12 @@ static void container_thread_entry(void *args) {
}
core_mutex_unlock(&container->lock);

LOG_INF("Container thread %d exited cleanly", container->container_ID);
if (success) {
LOG_INF("Container %d completed successfully", container->container_ID);
} else {
LOG_ERR("Container %d failed: %s", container->container_ID,
exception ? exception : "unknown error");
}

// Clean up WASM runtime thread environment
wasm_runtime_destroy_thread_env();
Expand Down
2 changes: 1 addition & 1 deletion src/ocre/ocre_gpio/ocre_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int ocre_gpio_unregister_callback(int pin) {

void ocre_gpio_cleanup_container(wasm_module_inst_t module_inst) {
if (!gpio_system_initialized || !module_inst) {
LOG_ERR("GPIO system not initialized or invalid module %p", (void *)module_inst);
LOG_DBG("GPIO system not initialized or invalid module %p", (void *)module_inst);
return;
}
for (int i = 0; i < CONFIG_OCRE_GPIO_MAX_PINS; i++) {
Expand Down
2 changes: 1 addition & 1 deletion wasm-micro-runtime