Why do I get Transmit Status (0xB8) with error ADDRESS_NOT_FOUND/ROUTE_DISCOVERY if the packet is delivered correctly?

I am using an XBeeStick in API mode, DIGI wall Router, and a commercial ZigBee sensor. For communication with the XStick I am using xbee-api (Java).

I perform the following actions (more detailed log below):
[ul]
[li] Discover nodes[/li][li] Send TX REQUEST with discovered 64bit and 16bit address as unicast[/li][li] very shortly after sending the request (by far earlier than the timeout) I frequently[/li] receiving a ZNetTxStatusResponse with
deliveryStatus=ADDRESS_NOT_FOUND and
discoveryStatus=ROUTE_DISCOVERY
[li] shortly after that, I am receiving the ZNetRxResponse from the End device that was requested[/li][/ul]

All the code-snippets that I could find on the net and in the forum seem to agree that
a status response with anything else but SUCCESS in the delivery status means ‘failure’,
i.e. the packet did not get delivered.

But in fact, it has been, because I receive the correct answer.

The time between request and response (in the order of 8s) is far below the max. sleep time
in the net (28s). It also does not matter if I send the transmission with the correct 16bit
address or with 0xFFFE.

What am I missing here?

Thanks in advance
Hartmut

PS: Here is a typical log trace from my application:


09:41:40.799 [pool-1-thread-1] DEBUG sensors.digi.Network - Starting discovery...
09:41:43.582 [pool-2-thread-1] INFO  sensors.digi.Network - Node Discovered is ZBNodeDiscover nodeAddress16=0xca,0x4f, nodeAddress64=XBeeAddress64(address=[0, 19, 162, 0, 64, 159, 53, 167]), nodeIdentifier=DIGI-Wall, parentAddress=0xff,0xfe, deviceType=DEV_TYPE_ROUTER, status=0, profileId=0xc1,0x05, mfgId=0x10,0x1e
09:41:43.583 [pool-2-thread-1] DEBUG sensors.digi.Network - Adding new device 0x0013a200409f35a7
09:41:44.155 [pool-2-thread-1] INFO  sensors.digi.Network - Node Discovered is ZBNodeDiscover nodeAddress16=0x31,0x37, nodeAddress64=XBeeAddress64(address=[0, 19, 162, 0, 64, 171, 80, 76]), nodeIdentifier=Router, parentAddress=0xff,0xfe, deviceType=DEV_TYPE_ROUTER, status=0, profileId=0xc1,0x05, mfgId=0x10,0x1e
09:41:44.155 [pool-2-thread-1] DEBUG sensors.digi.Network - Adding new device 0x0013a20040ab504c
09:41:50.761 [pool-2-thread-1] INFO  sensors.digi.Network - Node Discovered is ZBNodeDiscover nodeAddress16=0xb3,0x72, nodeAddress64=XBeeAddress64(address=[0, 19, 162, 0, 64, 170, 76, 108]), nodeIdentifier=SensorNode, parentAddress=0x31,0x37, deviceType=DEV_TYPE_END_DEVICE, status=0, profileId=0xc1,0x05, mfgId=0x10,0x1e
09:41:50.761 [pool-2-thread-1] DEBUG sensors.digi.Network - Adding new device 0x0013a20040aa4c6c
09:42:14.802 [pool-1-thread-1] DEBUG sensors.digi.Network - ...Discovered: [nodeAddress16=0xca,0x4f, nodeAddress64=XBeeAddress64(address=[0, 19, 162, 0, 64, 159, 53, 167]), nodeIdentifier=DIGI-Wall, parentAddress=0xff,0xfe, deviceType=DEV_TYPE_ROUTER, status=0, profileId=0xc1,0x05, mfgId=0x10,0x1e, nodeAddress16=0x31,0x37, nodeAddress64=XBeeAddress64(address=[0, 19, 162, 0, 64, 171, 80, 76]), nodeIdentifier=ZBR100___4715, parentAddress=0xff,0xfe, deviceType=DEV_TYPE_ROUTER, status=0, profileId=0xc1,0x05, mfgId=0x10,0x1e, nodeAddress16=0xb3,0x72, nodeAddress64=XBeeAddress64(address=[0, 19, 162, 0, 64, 170, 76, 108]), nodeIdentifier=ZBS122009229, parentAddress=0x31,0x37, deviceType=DEV_TYPE_END_DEVICE, status=0, profileId=0xc1,0x05, mfgId=0x10,0x1e]
09:42:14.805 [main] INFO  sensors.digi.Network - Discovered 3 devices: DIGI-Wall,ZBR100___4715,ZBS122009229

09:42:14.811 [pool-1-thread-2] WARN  com.rapplogic.xbee.api.XBee - Sendig request: apiId=ZNET_TX_REQUEST (0x10),frameId=55,destAddr64=XBeeAddress64(address=[0, 19, 162, 0, 64, 170, 76, 108]),destAddr16=0xb3,0x72,broadcastRadius=0,option=UNICAST,payload=0x53,0x45,0x54,0x20,0x54,0x58,0x54,0x3d,0x39,0x30,0x0a
09:42:22.161 [pool-2-thread-1] INFO  sensors.digi.Network - Status response ZNetTxStatusResponse apiId=ZNET_TX_STATUS_RESPONSE (0x8b),length=7,checksum=0x13,error=false,frameId=0x37,remoteAddress16=0xff,0xfd,retryCount=8,deliveryStatus=ADDRESS_NOT_FOUND,discoveryStatus=ROUTE_DISCOVERY
09:42:22.161 [main] ERROR sensors.digi.Network - Status response NOT SUCCESSFUL: Sending SET TXT=90
 to Optional.of(ZBS122009229) showed an error: apiId=ZNET_TX_STATUS_RESPONSE (0x8b),length=7,checksum=0x13,error=false,frameId=0x37,remoteAddress16=0xff,0xfd,retryCount=8,deliveryStatus=ADDRESS_NOT_FOUND,discoveryStatus=ROUTE_DISCOVERY

09:42:22.412 [pool-1-thread-3] WARN  com.rapplogic.xbee.api.XBee - Sendig request: apiId=ZNET_TX_REQUEST (0x10),frameId=56,destAddr64=XBeeAddress64(address=[0, 19, 162, 0, 64, 170, 76, 108]),destAddr16=0xb3,0x72,broadcastRadius=0,option=UNICAST,payload=0x21,0x23,0x2a,0x52,0x45,0x47,0x31,0x0a
09:42:29.755 [pool-2-thread-1] INFO  sensors.digi.Network - Status response ZNetTxStatusResponse apiId=ZNET_TX_STATUS_RESPONSE (0x8b),length=7,checksum=0x1a,error=false,frameId=0x38,remoteAddress16=0xff,0xfd,retryCount=0,deliveryStatus=ADDRESS_NOT_FOUND,discoveryStatus=ROUTE_DISCOVERY
09:42:29.756 [main] ERROR sensors.digi.Network - Status response NOT SUCCESSFUL: Sending !#*REG1
 to Optional.of(ZBS122009229) showed an error: apiId=ZNET_TX_STATUS_RESPONSE (0x8b),length=7,checksum=0x1a,error=false,frameId=0x38,remoteAddress16=0xff,0xfd,retryCount=0,deliveryStatus=ADDRESS_NOT_FOUND,discoveryStatus=ROUTE_DISCOVERY
09:42:30.006 [pool-1-thread-4] WARN  com.rapplogic.xbee.api.XBee - Sendig request: apiId=ZNET_TX_REQUEST (0x10),frameId=57,destAddr64=XBeeAddress64(address=[0, 19, 162, 0, 64, 170, 76, 108]),destAddr16=0xb3,0x72,broadcastRadius=0,option=UNICAST,payload=0x21,0x23,0x2a,0x52,0x45,0x47,0x32,0x0a
09:42:31.818 [pool-2-thread-1] INFO  sensors.digi.Network - Status response ZNetTxStatusResponse apiId=ZNET_TX_STATUS_RESPONSE (0x8b),length=7,checksum=0x12,error=false,frameId=0x39,remoteAddress16=0xb3,0x72,retryCount=4,deliveryStatus=SUCCESS,discoveryStatus=NO_DISCOVERY
09:42:31.841 [pool-2-thread-1] INFO  sensors.digi.Network - ZNetRxResponse apiId=ZNET_RX_RESPONSE (0x90),length=29,checksum=0xe3,error=false,remoteAddress64=XBeeAddress64(address=[0, 19, 162, 0, 64, 170, 76, 108]),remoteAddress16=0xb3,0x72,option=PACKET_ACKNOWLEDGED,data=0x61,0x63,0x6b,0x3a,0x20,0x73,0x65,0x74,0x20,0x74,0x78,0x74,0x3d,0x39,0x30,0x0a,0x0a
(here is the correct answer to the request I sent at 09:42:14.811)
09:42:32.070 [pool-1-thread-5] WARN  com.rapplogic.xbee.api.XBee - Sendig request: apiId=ZNET_TX_REQUEST (0x10),frameId=58,destAddr64=XBeeAddress64(address=[0, 19, 162, 0, 64, 170, 76, 108]),destAddr16=0xb3,0x72,broadcastRadius=0,option=UNICAST,payload=0x21,0x23,0x2a,0x52,0x45,0x47,0x33,0x0a
09:42:32.170 [pool-2-thread-1] INFO  sensors.digi.Network - Status response ZNetTxStatusResponse apiId=ZNET_TX_STATUS_RESPONSE (0x8b),length=7,checksum=0x15,error=false,frameId=0x3a,remoteAddress16=0xb3,0x72,retryCount=0,deliveryStatus=SUCCESS,discoveryStatus=NO_DISCOVERY
09:42:32.283 [pool-2-thread-1] INFO  sensors.digi.Network - ZNetRxResponse apiId=ZNET_RX_RESPONSE (0x90),length=53,checksum=0x04,error=false,remoteAddress64=XBeeAddress64(address=[0, 19, 162, 0, 64, 170, 76, 108]),remoteAddress16=0xb3,0x72,option=PACKET_ACKNOWLEDGED,data=0x4d,0x41,0x4e,0x52,0x45,0x51,0x3d,0x30,0x0a,0x54,0x4d,0x53,0x54,0x41,0x52,0x54,0x3d,0x33,0x30,0x0a,0x54,0x4d,0x46,0x52,0x45,0x45,0x3d,0x36,0x30,0x0a,0x54,0x4d,0x52,0x45,0x50,0x3d,0x31,0x30,0x30,0x0a,0x0a
(here is the correct answer to the request I sent at 09:42:22.412)

Is the node you are sending the request to an End node?

Yes, the node I am sending to is an End Node.

I have found the answer myself:

The problem results from the fact that the ‘default’ timeout is used by default by the xbee-api. This timeout is quite short and - I am guessing - primarily intended for routers or other mains-powered devices with very short sleep periods.

End-devices with long sleep periods requires the options bit USE_EXTENDED_TIMEOUT to be set. This extends the timeout appropriately with the SP value stored in the coordinator (which should be the maximum sleep period occurring in the network).