-
Notifications
You must be signed in to change notification settings - Fork 378
AMQP transport failed to establish connection with service. #17
Copy link
Copy link
Closed
Description
I have written a simple Python script with the following logic, summary it initiated the iothub_client once and loops forever. After some time, it seems to stop working, presumably when the authentication (using "iotHubClient = IoTHubClient(connection_string, protocol)" and the AMQP protocol) needs regenerate a SAS token.
Other than running "iotHubClient = iothub_client_init()", which seems inefficient, I suggest that the Python code not have to worry about it and the C code try to re-authenticate.
def main():
global iotHubClient, UDP_IP, UDP_PORT
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
iotHubClient = iothub_client_init()
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
data = data.replace('\r\n', '')
try:
UDPMessage = data.split(':')
if UDPMessage[0] == "TempUpdate":
message = '{ "event": "%s", "sensor": "%s", "temperature": %3.2f}' % (UDPMessage[0], UDPMessage[1], float(UDPMessage[2]))
print message
IoTmessage = IoTHubMessage(bytearray(str(message), 'utf8'))
iotHubClient.send_event_async(IoTmessage, send_confirmation_callback, message)
except:
print data
except IoTHubError as e:
print("Unexpected error %s from IoTHub" % e)
return
except KeyboardInterrupt:
print("IoTHubClient sample stopped")``
**Error I am seeing:**
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:364 Failure: select failure.
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp.c Func:establishConnection Line:643 Failed to open the connection with CBS.
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp.c Func:IoTHubTransportAMQP_DoWork Line:1351 AMQP transport failed to establish connection with service.
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp_auth.c Func:authentication_reset Line:637 Failed to reset the authentication state (authentication status is invalid: 2)
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp.c Func:prepareDeviceForConnectionRetry Line:1080 Failed resetting the authenticatication state of device
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp_methods.c Func:iothubtransportamqp_methods_unsubscribe Line:719 unsubscribe called while not subscribed
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp.c Func:destroyMessageReceiver Line:883 Failed closing the AMQP message receiver.
Reactions are currently unavailable