Tanganelli / CoAPthon3

CoAPthon3 is a porting to python3 of my CoAPthon library. CoAPthon3 is a python3 library to the CoAP protocol compliant with the RFC. Branch is available for the Twisted framework.
MIT License
58 stars 50 forks source link

"Un-Matched incoming response message" for /obs and Exception for /.well-known/core #6

Open expliotlabs opened 6 years ago

expliotlabs commented 6 years ago

Hi,

I have a very simple script to query californium.eclipse.org. Im querying two URIs

  1. /obs - This gives the Un-Matched incoming message log and keeps on retrying
  2. /.well-known/core - This throws an exception.

Is there anything Im doing wrong? I have tried with a different library (in ruby) and it works so it doesnt look like it is a server or connection issue.

Below are the details:


  1. script:

    !/usr/bin/python3

    from coapthon.client.helperclient import HelperClient

c = HelperClient(server=("californium.eclipse.org", 5683)) r = c.get("/.well-known/core") # The other query is for /obs print("r class {}".format(r.class.name))


  1. Exception for /.well-known/core

    Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/coapthon/serializer.py", line 76, in deserialize option_item = defines.OptionRegistry.LIST[current_option] KeyError: 28

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.5/dist-packages/coapthon/client/coap.py", line 261, in receive_datagram message = serializer.deserialize(datagram, source) File "/usr/local/lib/python3.5/dist-packages/coapthon/serializer.py", line 78, in deserialize (optcritical, , _) = defines.OptionRegistry.get_option_flags(current_option) File "/usr/local/lib/python3.5/dist-packages/coapthon/defines.py", line 166, in get_option_flags opt_bytes = array.array('B', '\0\0') TypeError: cannot use a str to initialize an array with typecode 'B'

Exception in thread Thread-2: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/coapthon/serializer.py", line 76, in deserialize option_item = defines.OptionRegistry.LIST[current_option] KeyError: 28

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.5/dist-packages/coapthon/client/coap.py", line 261, in receive_datagram message = serializer.deserialize(datagram, source) File "/usr/local/lib/python3.5/dist-packages/coapthon/serializer.py", line 78, in deserialize (optcritical, , _) = defines.OptionRegistry.get_option_flags(current_option) File "/usr/local/lib/python3.5/dist-packages/coapthon/defines.py", line 166, in get_option_flags opt_bytes = array.array('B', '\0\0') TypeError: cannot use a str to initialize an array with typecode 'B'

Exception in thread Thread-3: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/coapthon/serializer.py", line 76, in deserialize option_item = defines.OptionRegistry.LIST[current_option] KeyError: 28

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.5/dist-packages/coapthon/client/coap.py", line 261, in receive_datagram message = serializer.deserialize(datagram, source) File "/usr/local/lib/python3.5/dist-packages/coapthon/serializer.py", line 78, in deserialize (optcritical, , _) = defines.OptionRegistry.get_option_flags(current_option) File "/usr/local/lib/python3.5/dist-packages/coapthon/defines.py", line 166, in get_option_flags opt_bytes = array.array('B', '\0\0') TypeError: cannot use a str to initialize an array with typecode 'B'

Exception in thread Thread-4: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/coapthon/serializer.py", line 76, in deserialize option_item = defines.OptionRegistry.LIST[current_option] KeyError: 28

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.5/dist-packages/coapthon/client/coap.py", line 261, in receive_datagram message = serializer.deserialize(datagram, source) File "/usr/local/lib/python3.5/dist-packages/coapthon/serializer.py", line 78, in deserialize (optcritical, , _) = defines.OptionRegistry.get_option_flags(current_option) File "/usr/local/lib/python3.5/dist-packages/coapthon/defines.py", line 166, in get_option_flags opt_bytes = array.array('B', '\0\0') TypeError: cannot use a str to initialize an array with typecode 'B'


  1. Log messages for /.well-known/core

    2018-04-10 16:21:35,431 - MainThread - coapthon.layers.messagelayer - DEBUG - send_request - From None, To ('californium.eclipse.org', 5683), None-None, GET-ez, [Uri-Path: .well-known, Uri-Path: core, ] No payload 2018-04-10 16:21:35,431 - MainThread - coapthon.client.coap - DEBUG - send_datagram - From None, To ('californium.eclipse.org', 5683), CON-34208, GET-ez, [Uri-Path: .well-known, Uri-Path: core, ] No payload 2018-04-10 16:21:35,444 - Thread-1 - coapthon.client.coap - DEBUG - Start receiver Thread 2018-04-10 16:21:35,444 - MainThread-Retry-34208 - coapthon.client.coap - DEBUG - retransmit loop ... enter 2018-04-10 16:21:38,252 - MainThread-Retry-34208 - coapthon.client.coap - DEBUG - retransmit loop ... retransmit Request 2018-04-10 16:21:38,252 - MainThread-Retry-34208 - coapthon.client.coap - DEBUG - send_datagram - From None, To ('californium.eclipse.org', 5683), CON-34208, GET-ez, [Uri-Path: .well-known, Uri-Path: core, ] No payload 2018-04-10 16:21:38,263 - Thread-2 - coapthon.client.coap - DEBUG - Start receiver Thread 2018-04-10 16:21:43,876 - MainThread-Retry-34208 - coapthon.client.coap - DEBUG - retransmit loop ... retransmit Request 2018-04-10 16:21:43,876 - MainThread-Retry-34208 - coapthon.client.coap - DEBUG - send_datagram - From None, To ('californium.eclipse.org', 5683), CON-34208, GET-ez, [Uri-Path: .well-known, Uri-Path: core, ] No payload 2018-04-10 16:21:43,887 - Thread-3 - coapthon.client.coap - DEBUG - Start receiver Thread 2018-04-10 16:21:55,113 - MainThread-Retry-34208 - coapthon.client.coap - DEBUG - retransmit loop ... retransmit Request 2018-04-10 16:21:55,114 - MainThread-Retry-34208 - coapthon.client.coap - DEBUG - send_datagram - From None, To ('californium.eclipse.org', 5683), CON-34208, GET-ez, [Uri-Path: .well-known, Uri-Path: core, ] No payload 2018-04-10 16:21:55,138 - Thread-4 - coapthon.client.coap - DEBUG - Start receiver Thread 2018-04-10 16:23:02,496 - MainThread-Retry-34208 - coapthon.client.coap - WARNING - Give up on message From None, To ('californium.eclipse.org', 5683), CON-34208, GET-ez, [Uri-Path: .well-known, Uri-Path: core, ] No payload 2018-04-10 16:23:02,497 - MainThread-Retry-34208 - coapthon.client.coap - DEBUG - retransmit loop ... exit r class NoneType


  1. Log messages for /obs

    2018-04-10 16:18:25,261 - MainThread - coapthon.layers.messagelayer - DEBUG - send_request - From None, To ('californium.eclipse.org', 5683), None-None, GET-Fa, [Uri-Path: obs, ] No payload 2018-04-10 16:18:25,261 - MainThread - coapthon.client.coap - DEBUG - send_datagram - From None, To ('californium.eclipse.org', 5683), CON-39116, GET-Fa, [Uri-Path: obs, ] No payload 2018-04-10 16:18:25,271 - Thread-1 - coapthon.client.coap - DEBUG - Start receiver Thread 2018-04-10 16:18:25,271 - MainThread-Retry-39116 - coapthon.client.coap - DEBUG - retransmit loop ... enter 2018-04-10 16:18:25,681 - Thread-1 - coapthon.client.coap - DEBUG - receive_datagram - From ('104.196.15.150', 5683), To None, ACK-39116, CONTENT-Fa, [Content-Type: 0, Max-Age: 5, ] 10:48:21...8 bytes 2018-04-10 16:18:25,681 - Thread-1 - coapthon.layers.messagelayer - DEBUG - receive_response - From ('104.196.15.150', 5683), To None, ACK-39116, CONTENT-Fa, [Content-Type: 0, Max-Age: 5, ] 10:48:21...8 bytes 2018-04-10 16:18:25,681 - Thread-1 - coapthon.layers.messagelayer - WARNING - Un-Matched incoming response message 104.196.15.150:5683 2018-04-10 16:18:27,531 - MainThread-Retry-39116 - coapthon.client.coap - DEBUG - retransmit loop ... retransmit Request 2018-04-10 16:18:27,531 - MainThread-Retry-39116 - coapthon.client.coap - DEBUG - send_datagram - From None, To ('californium.eclipse.org', 5683), CON-39116, GET-Fa, [Uri-Path: obs, ] No payload 2018-04-10 16:18:27,932 - Thread-1 - coapthon.client.coap - DEBUG - receive_datagram - From ('104.196.15.150', 5683), To None, ACK-39116, CONTENT-Fa, [Content-Type: 0, Max-Age: 5, ] 10:48:21...8 bytes 2018-04-10 16:18:27,932 - Thread-1 - coapthon.layers.messagelayer - DEBUG - receive_response - From ('104.196.15.150', 5683), To None, ACK-39116, CONTENT-Fa, [Content-Type: 0, Max-Age: 5, ] 10:48:21...8 bytes 2018-04-10 16:18:27,932 - Thread-1 - coapthon.layers.messagelayer - WARNING - Un-Matched incoming response message 104.196.15.150:5683 2018-04-10 16:18:32,061 - MainThread-Retry-39116 - coapthon.client.coap - DEBUG - retransmit loop ... retransmit Request 2018-04-10 16:18:32,062 - MainThread-Retry-39116 - coapthon.client.coap - DEBUG - send_datagram - From None, To ('californium.eclipse.org', 5683), CON-39116, GET-Fa, [Uri-Path: obs, ] No payload 2018-04-10 16:18:32,375 - Thread-1 - coapthon.client.coap - DEBUG - receive_datagram - From ('104.196.15.150', 5683), To None, ACK-39116, CONTENT-Fa, [Content-Type: 0, Max-Age: 5, ] 10:48:21...8 bytes 2018-04-10 16:18:32,376 - Thread-1 - coapthon.layers.messagelayer - DEBUG - receive_response - From ('104.196.15.150', 5683), To None, ACK-39116, CONTENT-Fa, [Content-Type: 0, Max-Age: 5, ] 10:48:21...8 bytes 2018-04-10 16:18:32,376 - Thread-1 - coapthon.layers.messagelayer - WARNING - Un-Matched incoming response message 104.196.15.150:5683 2018-04-10 16:18:41,110 - MainThread-Retry-39116 - coapthon.client.coap - DEBUG - retransmit loop ... retransmit Request 2018-04-10 16:18:41,110 - MainThread-Retry-39116 - coapthon.client.coap - DEBUG - send_datagram - From None, To ('californium.eclipse.org', 5683), CON-39116, GET-Fa, [Uri-Path: obs, ] No payload 2018-04-10 16:18:41,963 - Thread-1 - coapthon.client.coap - DEBUG - receive_datagram - From ('104.196.15.150', 5683), To None, ACK-39116, CONTENT-Fa, [Content-Type: 0, Max-Age: 5, ] 10:48:21...8 bytes 2018-04-10 16:18:41,963 - Thread-1 - coapthon.layers.messagelayer - DEBUG - receive_response - From ('104.196.15.150', 5683), To None, ACK-39116, CONTENT-Fa, [Content-Type: 0, Max-Age: 5, ] 10:48:21...8 bytes 2018-04-10 16:18:41,963 - Thread-1 - coapthon.layers.messagelayer - WARNING - Un-Matched incoming response message 104.196.15.150:5683 2018-04-10 16:19:35,829 - MainThread-Retry-39116 - coapthon.client.coap - WARNING - Give up on message From None, To ('californium.eclipse.org', 5683), CON-39116, GET-Fa, [Uri-Path: obs, ] No payload 2018-04-10 16:19:35,830 - MainThread-Retry-39116 - coapthon.client.coap - DEBUG - retransmit loop ... exit r class NoneType