Aws-iot-device-sdk-python-v2: mensaje='La conexión se cerró inesperadamente.', código=5134 region us-west-1

Creado en 1 feb. 2021  ·  7Comentarios  ·  Fuente: aws/aws-iot-device-sdk-python-v2

Confirme cambiando [ ] a [x] a continuación para asegurarse de que se trata de un error:

Problema conocido

  • [X] Estoy usando el punto final del tipo de datos ATS: el punto final debería verse como <prefix>-ats.iot.<region>.amazonaws.com
    xxxxxxxxx-ats.iot.us-west-1.amazonaws.com

Describa el error
Pasó por "Primeros pasos y registro del dispositivo"
Tengo certificado, clave privada, clave pública y CA

Número de versión del SDK
2 (python3)

Plataforma/SO/Dispositivo
¿En qué estás ejecutando el SDK?
ubuntu

Reproducir (comportamiento observado)
Pasos para reproducir el comportamiento (comparta el código)
Muestra simple de publicación/suscripción
python3 pubsub.py --endpoint xxxxxxxxxx-ats.iot.us-west-1.amazonaws.com --root-ca root-CA.crt --cert zztest.cert.pem --key zztest.private.key -- depuración de verbosidad

 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [programador de tareas] - id=0x7fc744013750: Programación de la tarea socket_handler_close para ejecución inmediata
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [programador de tareas] - id=0x7fc7440021b0: Ejecutando la tarea epoll_event_loop_unsubscribe_cleanup conestado
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [programador de tareas] - id=0x7fc744013750: Ejecutando la tarea socket_handler_close conestado
 [DEPURACIÓN] [2021-02-01T06:03:41Z] [00007fc75343a700] [canal] - id=0x7fc744002770: controlador 0x7fc7440136b0 apagado en el directorio de escritura completado.
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [programador de tareas] - id=0x7fc744002798: Tarea de programación (nula) para ejecución inmediata
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [programador de tareas] - id=0x7fc744002798: Tarea en ejecución (nula) conestado
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [canal] - id=0x7fc744002770: durante el apagado, cancelando la tarea 0x7fc744013920
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [programador de tareas] - id=0x7fc744013920: Ejecutando la tarea tls_timeout conestado
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [canal] - id=0x7fc744002770: durante el apagado, cancelando la tarea 0x7fc74402de40
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [programador de tareas] - id=0x7fc74402de40: Ejecutando la tarea mqtt_connack_timeout conestado
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [channel-bootstrap] - id=0x10f7550: canal 0x7fc744002770 apagado con error 0.
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [canal] - id=0x7fc744002770: canal de destrucción.
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [channel-bootstrap] - id=0x10f7550: liberación de la referencia de arranque
 Rastreo (llamadas recientes más última):
 Archivo "pubsub.py", línea 130, en
 conectar_futuro.resultado()
 Archivo "/usr/lib/python3.6/concurrent/futures/_base.py", línea 432, en resultado
 devolver self.__get_result()
 Archivo "/usr/lib/python3.6/concurrent/futures/_base.py", línea 384, en __get_result
 aumentar self._exception
 awscrt.exceptions.AwsCrtError: AwsCrtError(name='AWS_ERROR_MQTT_UNEXPECTED_HANGUP', message='La conexión se cerró inesperadamente', code=5134)
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75814b740] [mqtt-client] - id=0x12fbb80: el usuario llamó a desconectar.
 [ERROR] [2021-02-01T06:03:41Z] [00007fc75814b740] [mqtt-client] - id=0x12fbb80: la conexión no está abierta y es posible que no se cierre
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75814b740] [mqtt-client] - id=0x12fbb80: se ha liberado el último refcount en la conexión, comience a destruir la conexión.
 [DEBUG] [2021-02-01T06:03:41Z] [00007fc75814b740] [mqtt-client] - id=0x12fbb80: Destruyendo la conexión

Comportamiento esperado
Una descripción clara y concisa de lo que esperaba que sucediera.
mensajes continuamente publicados

Registros/salida
Si corresponde, agregue registros o resultados de error.

RECUERDA SANITIZAR TU INFORMACIÓN PERSONAL

awscrt.io.init_logging(awscrt.io.LogLevel.Warn, 'stderr')

Contexto adicional
Agregue cualquier otro contexto sobre el problema aquí.

Esto parece un poco tonto y confuso...
image
¿Por qué hay 2 cosas diferentes llamadas IoT Core en la consola de administración?
Actualmente estoy trabajando en la región us-west-1 (N. California)...
Dice que uno de ellos IoT Core no es compatible; luego, si hago clic en el otro ícono, dice que sí lo es, ¿puede explicarlo?
image

y aquí está el que funciona en us-west-1
image
¿O no funciona? es que el problema de raiz... funciona pero no funciona... :P

closed-for-staleness guidance

Comentario más útil

Me siento tan tonto en este momento, el error para mí fue que no había activado el certificado en la consola de IoT. Esto es algo estúpido pero podría ayudar a otros.

Todos 7 comentarios

¿Qué versión de python3 y Ubuntu estás usando? Además, ¿qué permisos está utilizando para la política de IAM? Parece que tiene problemas para conectarse, por lo que le recomiendo comenzar con AWSIoTFullAccess para descartar que su política sea el problema. Solo asegúrese de restringirlo solo a las acciones y recursos que realmente necesita más adelante.

AWSIoTFullAccess:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:*"
            ],
            "Resource": "*"
        }
    ]
}

En cuanto al contenido adicional que mencionó, uno de ellos tiene iot en la URL mientras que el otro tiene iotv2 . ¿Cuál es el que te está funcionando?

Gracias por la respuesta jmklix.
¿Lo que sugirió es específicamente para MQTT?
Obtuve websockets para trabajar, pero solo con credenciales de .aws que, para nuestro caso de uso, no creo que sea deseable.
¿Pueden los websockets autenticarse y autorizarse usando los archivos de certificado (xxxx.pem xxx.private.key xxx.public.key) que consume mqtt?

Sí, entendí la URL iot/iot2... ¿hay alguna documentación que explique la diferencia entre las dos versiones principales de iot?
También hay 2 sdks de python para clientes, uno es para python 2.7 y el otro para python 3, ¿hay más diferencias? ¿Están estrechamente emparejados con las versiones principales de iot e iot2? ¿Son compatibles con cross o back? ¿Hay documentación para esto?

Sí, es para MQTT. No, no puedes usar archivos cert con web-sockets

Puede editar la política para IoT things que ya están creadas en la consola de AWS. Seleccione thing y seleccione seguridad en la barra lateral secundaria. Allí debería ver los certificados y querrá seleccionar ese certificado. Una vez que esté abierta, seleccione la política en la barra lateral secundaria. Luego seleccione esa política y finalmente haga clic en Edit policy document y pegue el AWSIoTFullAccess que mencioné anteriormente. La política predeterminada no funciona con los SDK v2. Por favor, hágamelo saber si necesita alguna explicación adicional.

La URL iot es la que desea usar, ya que iotv2 ya no debería estar visible y se eliminará en breve. Los sdk de python e iot son independientes entre sí y no tienen ninguna relación. El iot v1 es compatible con python 2 y 3, mientras que el iot v2 solo es compatible con python 3. Los sdk de iot no son compatibles con versiones anteriores o cruzadas y la documentación para la API v2 se puede encontrar aquí .

Tengo el mismo problema, utilicé la política @jmklix incluida anteriormente, creé un nuevo certificado manualmente, lo vinculé con IoT Thing y la política y descargué el .pem, la clave privada y la CA raíz de esta manera:

python3 shadow.py --endpoint xxxxxxxxxx-ats.iot.us-east-2.amazonaws.com --root-ca root-CA.crt --cert 726290b105-certificate.pem.crt --key 726290b105-private.pem.key --thing-name MyThingName

El ejemplo de shadow.py dice que --cert debe estar en formato .pem, así que también probé con 726290b105-certificate.pem

El mismo error ocurre con el ejemplo pubsub.py.

Estoy usando una Raspberry pi con Python 3.

Intenté instalar con PyPI e instalar con fuente.

El error ocurre en connected_future.result() en el ejemplo shadow.py.

Tengo un componente que publica usando MQTT similar a la muestra ipc_greengrass.py y funciona bien.

Mi sospecha es que estoy haciendo algo mal al incluir la clave, el certificado y --rood-ca. Aunque verifiqué dos veces los formatos de los archivos. Estoy recibiendo este error:

Traceback (most recent call last):
  File "shadow.py", line 275, in <module>
    connected_future.result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
awscrt.exceptions.AwsCrtError: AwsCrtError(name='AWS_ERROR_MQTT_UNEXPECTED_HANGUP', 
message='The connection was closed unexpectedly.',
code=5134)

Ejecutando con --verbosidad --debug

[INFO] [2021-02-18T19:57:17Z] [b7b6bec0] [event-loop] - id=0xa4371f0: Initializing edge-triggered epoll
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [event-loop] - id=0xa4371f0: Eventfd not available, falling back to pipe for cross-thread notification.
[INFO] [2021-02-18T19:57:17Z] [b7b6bec0] [event-loop] - id=0xa4371f0: Starting event-loop thread.
[INFO] [2021-02-18T19:57:17Z] [b7b6bec0] [dns] - id=0xa42b310: Initializing default host resolver with 16 max host entries.
[INFO] [2021-02-18T19:57:17Z] [b7050b40] [thread] - id=0xa3eeb8c: a cpu affinity was specified when launching this thread and set_mempolicy() is available on this system. Setting the memory policy to MPOL_PREFERRED
[WARN] [2021-02-18T19:57:17Z] [b7050b40] [thread] - id=0xa3eeb8c: call to set_mempolicy() failed with errno 38
[INFO] [2021-02-18T19:57:17Z] [b7b6bec0] [channel-bootstrap] - id=0xa44d200: Initializing client bootstrap with event-loop group 0xa43ea60
[INFO] [2021-02-18T19:57:17Z] [b684fb40] [event-loop] - id=0xa4371f0: main loop started
[INFO] [2021-02-18T19:57:17Z] [b684fb40] [event-loop] - id=0xa4371f0: default timeout 100000, and max events to process per tick 100
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [tls-handler] - ctx: Certificate and key have been set, setting them up now.
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [tls-handler] - ctx: Setting ALPN list x-amzn-mqtt-ca
Connecting to <endpoint> with client ID 'test-1e0e6e8b-ee1f-441d-8956-69aaedcb937d'...
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - client=0xa4ee030: Initalizing MQTT client
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - id=0xa450e40: Creating new connection
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-topic-tree] - tree=0xa450f94: Creating new topic tree
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - id=0xa450e40: Begin connecting process, switch state to CONNECTING.
[INFO] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - id=0xa450e40: using ping timeout of 3000000000 ns
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [dns] - id=0xa42b310: Host resolution requested for a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [dns] - id=0xa42b310: No cached entries found for a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com starting new resolver thread.
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: resolving host a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: resolved record: 3.131.31.52
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: resolved record: 52.15.119.124
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: resolved record: 13.59.30.89
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: resolved record: 2600:1f00:6000::383:1f34
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: resolved record: 2600:1f00:6000::340f:777c
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: resolved record: 2600:1f00:6000::d3b:1e59
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: new address resolved 3.131.31.52 for host a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com caching
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: new address resolved 52.15.119.124 for host a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com caching
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: new address resolved 13.59.30.89 for host a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com caching
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: new address resolved 2600:1f00:6000::383:1f34 for host a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com caching
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: new address resolved 2600:1f00:6000::340f:777c for host a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com caching
[DEBUG] [2021-02-18T19:57:17Z] [b5754b40] [dns] - static: new address resolved 2600:1f00:6000::d3b:1e59 for host a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com caching
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb4e03050: Scheduling attempt_connection task for immediate execution
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb4e03b50: Scheduling attempt_connection task for immediate execution
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb4e03050: Running attempt_connection task with <Running> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: initializing with domain 1 and type 0
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: setting socket options to: keep-alive 0, keep idle 0, keep-alive interval 0, keep-alive probe count 0.
[WARN] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: setsockopt() for NO_SIGNAL failed with errno 92. If you are having SIGPIPE signals thrown, you may want to install a signal trap in your application layer.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: beginning connect.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: connecting to endpoint 2600:1f00:6000::383:1f34:443.
[ERROR] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: connect failed with error code 101.
[INFO] [2021-02-18T19:57:17Z] [b684fb40] [dns] - id=0xa42b310: recording failure for record 2600:1f00:6000::383:1f34 for a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com, moving to bad list
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [dns] - static: purging address 2600:1f00:6000::383:1f34 for host a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com from the cache due to cache eviction or shutdown
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: is still open, closing...
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: closing
[ERROR] [2021-02-18T19:57:17Z] [b684fb40] [channel-bootstrap] - id=0xa44d200: failed to create socket with error 1049
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb4e03b50: Running attempt_connection task with <Running> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: initializing with domain 0 and type 0
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: setting socket options to: keep-alive 0, keep idle 0, keep-alive interval 0, keep-alive probe count 0.
[WARN] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: setsockopt() for NO_SIGNAL failed with errno 92. If you are having SIGPIPE signals thrown, you may want to install a signal trap in your application layer.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: beginning connect.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: connecting to endpoint 3.131.31.52:443.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01aa0: Scheduling (null) task for future execution at time 8129633861413
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01ae0: Scheduling epoll_event_loop_unsubscribe_cleanup task for immediate execution
[INFO] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: connection success
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: local endpoint 10.0.2.15:39292
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: assigning to event loop 0xa4371f0
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel-bootstrap] - id=0xa44d200: client connection on socket 0xb5d00b70 completed with error 0.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: Beginning creation and setup of new channel.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01e30: Scheduling on_channel_setup_complete task for immediate execution
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01ae0: Running epoll_event_loop_unsubscribe_cleanup task with <Running> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01e30: Running on_channel_setup_complete task with <Running> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: setup complete, notifying caller.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: no message pool is currently stored in the event-loop local storage, adding 0xb5d01f80 with max message size 16384, message count 4, with 4 small blocks of 128 bytes.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel-bootstrap] - id=0xa44d200: channel 0xb5d01c70 setup succeeded: bootstrapping.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket-handler] - id=0xb5d12620: Socket handler created with max_read_size of 16384
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d12718: Scheduling tls_timeout task for future execution at time 8134691976802
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [tls-handler] - id=0xb5d12700: Alpn protocol negotiated as x-amzn-mqtt-ca
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [tls-handler] - id=0xb5d12700: Remote server name is a1ypu7uyt3br9h-ats.iot.us-east-2.amazonaws.com
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel-bootstrap] - id=0xa44d200: tls negotiation result 0 on channel 0xb5d01c70
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [mqtt-client] - id=0xa450e40: Connection successfully opened, sending CONNECT packet
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d2c800: Scheduling mqtt_connack_timeout task for future execution at time 8127847022119
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [mqtt-client] - id=0xa450e40: Adding username ?SDK=PythonV2&Version=0.9.15 to connection
Traceback (most recent call last):
  File "shadow.py", line 275, in <module>
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [tls-handler] - id=0xb5d12700: Alert code 0
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01d88: Scheduling channel_shutdown task for immediate execution
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01d88: Running channel_shutdown task with <Running> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: beginning shutdown process
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: handler 0xb5d12620 shutdown in read dir completed.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [tls-handler] - id=0xb5d12700: Shutting down read direction with error code 0
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: handler 0xb5d12700 shutdown in read dir completed.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: handler 0xa450e54 shutdown in read dir completed.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01c84: Scheduling (null) task for immediate execution
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01c84: Running (null) task with <Running> status
[INFO] [2021-02-18T19:57:17Z] [b684fb40] [mqtt-client] - id=0xa450e40: sending disconnect message as part of graceful shutdown.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [mqtt-client] - id=0xa450e40: failed to send courteous disconnect io message
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: handler 0xa450e54 shutdown in write dir completed.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [tls-handler] - id=0xb5d12700: Shutting down write direction
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: handler 0xb5d12700 shutdown in write dir completed.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [socket] - id=0xb5d00b70 fd=7: closing
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01c40: Scheduling epoll_event_loop_unsubscribe_cleanup task for immediate execution
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d12674: Scheduling socket_handler_close task for immediate execution
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01c40: Running epoll_event_loop_unsubscribe_cleanup task with <Running> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d12674: Running socket_handler_close task with <Running> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: handler 0xb5d12620 shutdown in write dir completed.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01c84: Scheduling (null) task for immediate execution
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d01c84: Running (null) task with <Running> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: during shutdown, canceling task 0xb5d12718
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d12718: Running tls_timeout task with <Canceled> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: during shutdown, canceling task 0xb5d2c800
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [task-scheduler] - id=0xb5d2c800: Running mqtt_connack_timeout task with <Canceled> status
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel-bootstrap] - id=0xa44d200: channel 0xb5d01c70 shutdown with error 0.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel] - id=0xb5d01c70: destroying channel.
[DEBUG] [2021-02-18T19:57:17Z] [b684fb40] [channel-bootstrap] - id=0xa44d200: releasing bootstrap reference
    connected_future.result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
awscrt.exceptions.AwsCrtError: AwsCrtError(name='AWS_ERROR_MQTT_UNEXPECTED_HANGUP', message='The connection was closed unexpectedly.', code=5134)
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - id=0xa450e40: user called disconnect.
[ERROR] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - id=0xa450e40: Connection is not open, and may not be closed
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - id=0xa450e40: Last refcount on connection has been released, start destroying the connection.
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - id=0xa450e40: Destroying connection
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-topic-tree] - tree=0xa450f94: Cleaning up topic tree
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [mqtt-client] - client=0xa4ee030: Cleaning up MQTT client
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [channel-bootstrap] - id=0xa44d200: releasing bootstrap reference
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [channel-bootstrap] - id=0xa44d200: releasing bootstrap reference
[DEBUG] [2021-02-18T19:57:17Z] [b7b6bec0] [channel-bootstrap] - id=0xa44d200: destroying




Me siento tan tonto en este momento, el error para mí fue que no había activado el certificado en la consola de IoT. Esto es algo estúpido pero podría ayudar a otros.

@hackaprende gracias por compartir la solución donde te quedaste atascado.

Publicando aquí en caso de que esto ayude a futuros buscadores, también recibí el error awscrt.exceptions.AwsCrtError: AWS_ERROR_MQTT_UNEXPECTED_HANGUP: The connection was closed unexpectedly. y para mí, resulta que no había _activado_ el certificado de cosa de AWS IoT. Después de crearlo, hay otro paso para activarlo.

¿Fue útil esta página
0 / 5 - 0 calificaciones

Temas relacionados

mkozjak picture mkozjak  ·  8Comentarios

shravan097 picture shravan097  ·  6Comentarios

satay99 picture satay99  ·  6Comentarios

GauravPatni picture GauravPatni  ·  4Comentarios

victorct-pronto picture victorct-pronto  ·  3Comentarios