Azure Service Bus SDK for Python results in Read Timeout when sending a message to topic -
in application, send message topic based on local event. works quite until run network issue.
on network side, device going through access point provides primary/secondary connection internet. primary connection through adsl line if fails, switches on lte network. when switch-over occurs, ip address of device stays unchanged (as on local network , assigned through dhcp).
when switch-over occurs, find there error send command. local event , try send message service bus. first send results in 'readtimeout' subsequent send fine. local event , try send , process repeats itself. if reboot device works fine.
here 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)
per experience, think it's program flow problem of embedded application.
you can try add testing function ping service bus host interval seconds until network fine return boolean value start new connection after device switches network adaptor. meanwhile, count pinging till specified value call shell command service network restart
or ifconfig <eth-id> down && ifconfig <eth-id> up
restart related network adaptor.
it's idea. supply codes providing more useful help?
Comments
Post a Comment