In my application, I send a message to a topic based on a local event. This works quite well until I run into a network issue.
On the network side, my device is going through an access point that provides primary/secondary connection to the internet. The primary connection is through an ADSL line but if that fails, it switches over to an LTE network. When the switch-over occurs, the IP address of my device stays unchanged (as that is on the local network and assigned through DHCP).
When this switch-over occurs, I find that there is an error with the send command. I get my local event and try to send a message to the service bus. The first send results in a 'ReadTimeout' but a subsequent send is fine. I then get another local event and try another send and the process repeats itself. If I reboot the device then everything works fine.
Here is the stack-trace:
File "/usr/sbin/srvc/sb.py", line 420, in ReadTimeout: HTTPSConnectionPool(host='****.servicebus.windows.net', port= 443): Read timed out. (read timeout=65) Traceback (most recent call last):
File "/usr/sbin/srvc/sb.py", line 420, in peek_lock=False, timeout=sb_timeout) File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/servicebusservic e.py", line 976, in receive_subscription_message timeout) File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/servicebusservic e.py", line 762, in read_delete_subscription_message response = self._perform_request(request) File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/servicebusservic e.py", line 1109, in _perform_request resp = self._filter(request) File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/_http/httpclient .py", line 181, in perform_request self.send_request_body(connection, request.body) File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/_http/httpclient .py", line 145, in send_request_body connection.send(None) File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/_http/requestscl ient.py", line 81, in send self.response = self.session.request(self.method, self.uri, data=request_bod y, headers=self.headers, timeout=self.timeout) File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 457, in req uest resp = self.send(prep, **send_kwargs) File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 569, in sen d r = adapter.send(request, **kwargs) File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 422, in sen d raise ReadTimeout(e, request=request) ReadTimeout: HTTPSConnectionPool(host='****.servicebus.windows.net', port= 443): Read timed out. (read timeout=65)