Mesh.publish() alloc errors and function/variable issues

When publishing messages with Mesh.publish() my xenons will stop responding to calls for the cloud, resulting in functions not working and OTA updates not working. Particle.publish() messages do seem to continue working.

The main error message seems to be:

[] TRACE: input failed to alloc

I tested logging System.freeMemory() and there’s lots of normal memory available.

Example program:

SerialLogHandler logHandler(LOG_LEVEL_ALL);

void setup() {

void loop() {
  system_tick_t now = millis();
  if (Mesh.ready()) {

It also seems to result in the connection to the cloud server being rebuilt often:

0000123486 [] TRACE: input failed to alloc
0000128861 [] TRACE: input failed to alloc
0000134233 [] TRACE: input failed to alloc
0000134493 [comm.protocol] ERROR: Event loop error 1
0000134494 [system] WARN: Communication loop error, closing cloud socket
0000134496 [system] INFO: Cloud: disconnecting
0000134498 [system] INFO: Cloud: disconnected
0000134750 [system] INFO: Cloud: connecting
0000134753 [system] INFO: Read Server Address = type:1,domain:$
0000134755 [system] INFO: Loaded cloud server address and port from session data
0000134758 [system] TRACE: Address type: 1
0000134759 [system] TRACE: Cloud socket=0, family=10, type=2, protocol=17
0000134761 [system] INFO: Cloud socket=0, connecting to 64:FF9B::36A6:B5BF#5684
0000134763 [system] TRACE: Cloud socket=0, connected to 64:FF9B::36A6:B5BF#5684
0000134765 [system] TRACE: Updating cloud keepalive for AF_INET6: 30000 -> 30000
0000134768 [system] TRACE: Applying new keepalive interval now
0000134769 [system] INFO: Cloud socket connected
0000134771 [system] INFO: Starting handshake: presense_announce=0
0000134772 [comm.protocol.handshake] INFO: Establish secure connection
0000134972 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=0
0000134974 [comm.dtls] INFO: out_ctr 0,1,0,0,0,0,1,66, next_coap_id=12d
0000134975 [comm.dtls] INFO: app state crc: cached: 5eb2b659, actual: 5eb2b659
0000134978 [comm.dtls] WARN: skipping hello message
0000134979 [comm.dtls] INFO: restored session from persisted session data. next_msg_id=301
0000134981 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 2
0000134983 [comm.protocol.handshake] INFO: resumed session - not sending HELLO message
0000134989 [system] INFO: Send spark/hardware/max_binary event
0000134991 [system] INFO: Send subscriptions
0000134995 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000134997 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000134999 [comm] INFO: Sending TIME request
0000135002 [system] INFO: Cloud connected

Any suggestions?

The Mesh.publish() call syntax is

Mesh.publish(const char *name, const char *data);

You appear to be missing the event name or event data?

Hi @armor, thanks for the suggestion. I was originally seeing this issue with data included, I just removed it to make the test as simple as possible.

I double checked it and I think data shouldn’t be required. The docs include:

optional data (up to 255 bytes)

and the source does seem to include a default value:

int publish(const char* topic, const char* data = nullptr);

1 Like