Skip to content

LwM2M Execute Request Not Actioning

DodaTech Updated 2026-06-26 1 min read

In this tutorial, you'll learn about LwM2M Execute Request Not Actioning. We cover key concepts, practical examples, and best practices.

The Problem

LwM2M server execute request on a client resource does not trigger the action.

Quick Fix

Wrong

// Execute handler returns immediately without performing action
Server reports success but no action occurred.
# Anjay execute handler
#include <anjay/anjay.h>

static int reboot_exec(
  anjay_t *anjay, const anjay_rid_t *rid,
  anjay_execute_ctx_t *ctx) {
  
  // Read optional arguments (LwM2M 1.1)
  char arg[64];
  size_t len = anjay_exec_get_args(ctx, arg, sizeof(arg));
  if (len > 0) {
    printf('Execute with args: %s\n', arg);
  }
  
  // Schedule reboot (must not block here!)
  anjay_sched_delayed(anjay, 100, NULL, do_reboot);
  
  return 0;  # Success  2.04 Changed
}

# Resource definition
# {
#   'id': 4,
#   'name': 'Reboot',
#   'operations': 'E',
#   'type': ''
# }

# Resource must have 'E' in operations
# 'operations': 'E'  or  'operations': 'RWE'
Device reboots 100ms after execute request. Server receives 2.04 Changed.

Prevention

Execute handler must NOT block — it runs in the main event loop. Schedule delayed actions for long operations. Resources must have 'E' (Executable) in operations. Arguments are optional, defined by the resource specification. Return 0 for accepted, error code for rejection.

DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.

FAQ

### What response does Execute return?

CoAP 2.04 Changed (accepted) or 4.00/5.00 for errors. The actual action may complete later.

Can Execute have arguments?

LwM2M 1.0: optional text argument. LwM2M 1.1: structured arguments (CoAP Content-Format). Access via anjay_exec_get_args().

What standard resources are Executable?

Device object (3): Reboot (4), Factory Reset (5). Firmware Update (5): Update (1). Connectivity Monitoring (4): most resources are read-only.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro