Closed lbt closed 3 years ago
My bad.
I imported a long-lived django app and inside that app it run another mqtt client which publishes on save() and that wasn't being shutdown.
My logs had:
gmqtt.mqtt.protocol : [CONNECTION MADE]
gmqtt.mqtt.handler : [CMD 0x20] b'\x00\x00'
and later
gmqtt.mqtt.protocol : [CONNECTION MADE]
gmqtt.mqtt.handler : [CMD 0x20] b'\x00\x00'
Sorry for the noise.
Linux Python 3.7.3 mqtt 0.6.9
This is normal production setup that runs well. The problem occurs when trying to shutdown cleanly
Here is a log:
Ctrl-C hit at this point and the cleanup code is run in my finish() First my callbacks to handle any ongoing mqtt activity if there was any.
Still in finish() and "await client.disconnect()" is called
My on_disconnect callback is called:
and back in finish() this is the debug line after the await client.disconnect() so the client is now supposed to be shutdown
So now the main task is done and exiting ... lets see what task.print_stack() for each asyncio.all_tasks() has to say:
The asyncio.run(main()) is still there but the
__main__ : All done. Exiting
is the last line of main() so it should now exit. But the client is still running so it goes on to print:I think there is an unhandled exception going on in cb[MqttPackageHandler._handle_exception_in_future()]> but I'm not sure how to debug that yet.
This is my finish()
and the end of my main()