Closed seblucas closed 7 years ago
Thanks for the merge but that was not completely ready ;)
Anyway I'll push other fixes tomorrow
I still have an error with packet being null in process_gateway_messages and a mysterious [Errno 9] Bad file descriptor.
I never get any of this errors. I got "Bad file descriptor" when i am trying to run go app in alpine container without glibc - but it is really different case =))) Where did you get Bad file descriptor error?
My docker image is based on Alpine but no Go for me ;)
I get that error after using CTRL+C -> to make it harder to debug it does not happen every time (1 time out of 2 or 3) and I only have this message and no stack trace. I honestly don't know how to debug it further, so far :
gateway.stop()
as if I remove it the message is printed less often (1 time out of 5)Next idea I have is to add a big delay before calling gateway.stop()
to check when the message appear but that's a long shot.
Are you running\stopping it on your host system (for debug purpose) or in docker container? if you run it in container - you use docker exec -it container-id sh to run and then ctrl+c to stop? And also please publish your dockerfile\contrainer image - i will try to reproduce it on my raspberry pi (using your arm image) when I will have some free time.
All my tests were done within a Docker container and my command line was :
docker run -it --rm --net host -v /var/opt/docker/aqara/:/app/config seblucas/alpine-aqara
that launch your script automatically and than I type CTRL+C.
My alpine base image come from https://hub.docker.com/r/armhf/alpine/ My python3 base image is https://github.com/seblucas/docker-images/blob/master/alpine-python3/Dockerfile And my modified Dockerfile (based on yours) is there : https://gist.github.com/seblucas/b8f6728f50b293402abef7687e45fa5e
I won't be home this weekend so I can't share my full images but you should be able to build them easily.
I have checked it on raspberry pi and now i got it.
aqara | INFO:__main__:Stopping Polling Thread ...
aqara | [Errno 9] Bad file descriptor
aqara | INFO:__main__:Stopping MQTT Thread ...
aqara | INFO:__main__:Stopping Gateway Thread ...
I will try to figure out why it happens =)
I don't want to say that I'm happy about it ;) but that feels good.
More seriously, I'm going to update from alpine 3.4 to alpine 3.6 (so from python 3.5.2 to python 3.6.1), I'll let you know if that helps.
On the other hand, this only happens when stopping, it's strange but for now it's not a production breaker.
Sorry for getting back to you that late but I upgraded to Alpine 3.6 / python 3.6.1 and I still have the [Errno 9] Bad file descriptor
I'm new to this program and I'm trying a lot of things so I often start and stop the service and I noticed that it does not stop very cleanly (stopping all the threads). Here's what I currently use.
This is for now an RFC only as I still have an error with
packet
being null inprocess_gateway_messages
and a mysterious[Errno 9] Bad file descriptor
.What do you think of that ?