Python programs on X4 stop running after a day

Hi,

I have a Python program which does three main functions:

  1. Listens for ZigBee network messages.
  2. Makes HTTP GET requests when ZigBee messages are received.
  3. On a timer, polls devices on the network by issuing ddo_command() to cycle an output pin on the radio high and low (which then triggers the device to send a network message.)

The problem I’m having is that this program will stop running after about one day of uptime. I’ve updated the firmware of the X4 with the following versions:


Model: ConnectPort X4
Ethernet MAC Address: 00:40:9D:3C:C9:5A

Firmware Version: 2.8.4.30 (Version 82001536_E4 09/02/2009)
Boot Version: 1.1.3 (release_82001531_A)
POST Version: 1.1.3 (release_82001537_F)
Product VPD Version: release_82001747_A
Product ID: 0x0074
Hardware Strapping: 0x0043

CPU Utilization: 7%
Up Time: 4 days 45 minutes 55 seconds
Date and Time: Mon Jan 5 00:45:55 1970 (based on uptime)
Total Memory: 16384 KB
Used Memory: 13125 KB
Free Memory: 3259 KB

From my readings of the forum, I suspect it might be a memory issue. The X4 output for ‘display memory’ is as follows:


#> display memory

Memory Usage:

Main Memory :
Total Memory : 16777216
Used Memory : 13450988
Free Memory : 3326228

Network Memory : Current Maximum
Allocated : 208508 215820
In use : 182368 200984

Does anyone have an idea why this might be happening? Are there any best practices or resources on memory issues when using sockets that you can direct me to?

Thanks,

Josh

Hi Josh,

Well from information you have gathered it looks like the program is stuck somewhere. There doesn’t seem to be resource exhaustion on the device, so the other likely cause is a blocking interface of some kind.

From your outline of the program’s agenda, you may have at least 3 positions of blocking depending on the details. The Zigbee network receives, the HTTP GET requests, and the polling of devices on the Zigbee network. You may want to check to see if each command interacting with these interfaces can timeout in a reasonable way.

Another possibility is adding debugging statements when working to try and figure out where it gets stuck. This is ungainly, but the device doesn’t really support remote debugging of python programming at the moment.

A third method would be to stub out the Digi specific commands (Xbee ddo_commands, xbee_socket) and run the program on a PC where a debugger can be applied.

Hope this helps,
Max