ITD does not send packet to stop updates #45

Closed
opened 2022-12-05 07:10:38 +00:00 by CoderThomasB · 5 comments

Hi, I was inspecting ITD's traffic using Wireshark and noticed that when the 'watch' command was issued a packet would be sent to tell the watch to start sending back updates as expected. But when the command was stopped using Ctl-C the watch continued to send updates back with nothing to tell the watch to stop sending the updates. It isn't great for battery life if the watch continues to send updates even when ITD doesn't want them.

Here is a mock-up of what was happening:

itctl watch motion
Computer -> Watch: Please send me updates on the motion
Watch -> Computer: OK
Watch -> Computer: Update
Watch -> Computer: Update
Watch -> Computer: Update
Watch -> Computer: Update
Command exited using Ctl-C
The computer should tell the watch to stop sending updates but it doesn't.

Watch -> Computer: Update
Watch -> Computer: Update
Watch -> Computer: Update
Watch -> Computer: Update
Watch -> Computer: Update
...

Hi, I was inspecting ITD's traffic using Wireshark and noticed that when the 'watch' command was issued a packet would be sent to tell the watch to start sending back updates as expected. But when the command was stopped using Ctl-C the watch continued to send updates back with nothing to tell the watch to stop sending the updates. It isn't great for battery life if the watch continues to send updates even when ITD doesn't want them. ## Here is a mock-up of what was happening: itctl watch motion Computer -> Watch: Please send me updates on the motion Watch -> Computer: OK Watch -> Computer: Update Watch -> Computer: Update Watch -> Computer: Update Watch -> Computer: Update **Command exited using Ctl-C The computer should tell the watch to stop sending updates but it doesn't.** Watch -> Computer: Update Watch -> Computer: Update Watch -> Computer: Update Watch -> Computer: Update Watch -> Computer: Update ...
Owner

Do you have metrics enabled in ITD's config? Also, can you run ITD with ITD_LOGGING_LEVEL=debug and send the output here?

Do you have metrics enabled in ITD's config? Also, can you run ITD with `ITD_LOGGING_LEVEL=debug` and send the output here?
Author

I looked in the config file in etc and metrics were set to disable.

Running with ITD_LOGGING_LEVEL=debug Logs this once I start the watch command and nothing when it exits using Ctl-C

7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0

When the itd daemon (Not the itctl watch command) exits, it logs:

7:24PM DBG Received done signal func=WatchMotion

Here is the entire log:

7:18PM DBG InfiniTime device found in list mac=F9:5F:F9:ED:09:0F
7:18PM DBG Resolved characteristic name= uuid=00001532-1212-efde-1523-785feabcd123
7:18PM DBG Resolved characteristic name= uuid=00000001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Resolved characteristic name="New Alert" uuid=00002a46-0000-1000-8000-00805f9b34fb
7:18PM DBG Resolved characteristic name="Battery Level" uuid=00002a19-0000-1000-8000-00805f9b34fb
7:18PM DBG Resolved characteristic name="Notification Event" uuid=00020001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Resolved characteristic name= uuid=00000003-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Resolved characteristic name="Step Count" uuid=00030001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Resolved characteristic name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Resolved characteristic name="Filesystem Version" uuid=adaf0100-4669-6c65-5472-616e73666572
7:18PM DBG Resolved characteristic name="Heart Rate" uuid=00002a37-0000-1000-8000-00805f9b34fb
7:18PM DBG Resolved characteristic name= uuid=00000005-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Resolved characteristic name="Filesystem Transfer" uuid=adaf0200-4669-6c65-5472-616e73666572
7:18PM DBG Resolved characteristic name= uuid=00001531-1212-efde-1523-785feabcd123
7:18PM DBG Resolved characteristic name="Current Time" uuid=00002a2b-0000-1000-8000-00805f9b34fb
7:18PM DBG Resolved characteristic name= uuid=00000002-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Resolved characteristic name="Firmware Version" uuid=00002a26-0000-1000-8000-00805f9b34fb
7:18PM DBG Resolved characteristic name= uuid=00000004-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Resolved characteristic name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Firmware Version" uuid=00002a26-0000-1000-8000-00805f9b34fb
7:18PM INF Connected to InfiniTime version=1.11.0
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="New Alert" uuid=00002a46-0000-1000-8000-00805f9b34fb
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Current Time" uuid=00002a2b-0000-1000-8000-00805f9b34fb
7:18PM INF Initialized InfiniTime music controls
7:18PM INF Relaying calls to InfiniTime
7:18PM INF Relaying notifications to InfiniTime
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Filesystem Transfer" uuid=adaf0200-4669-6c65-5472-616e73666572
7:18PM INF Started control socket path=/tmp/itd/socket
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Adding weather event event={"DewPoint":6,"EventType":3,"Expires":3600,"Temperature":790,"Timestamp":1670440731}
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Adding weather event event={"Amount":0,"EventType":1,"Expires":3600,"Timestamp":1670440731,"Type":0}
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Adding weather event event={"DirectionMax":21,"DirectionMin":21,"EventType":2,"Expires":3600,"SpeedMax":1,"SpeedMin":1,"Timestamp":1670440731}
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Adding weather event event={"Amount":22,"EventType":8,"Expires":3600,"Timestamp":1670440731}
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Adding weather event event={"EventType":9,"Expires":3600,"Humidity":87,"Timestamp":1670440731}
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Adding weather event event={"EventType":6,"Expires":3600,"Pressure":1019,"Timestamp":1670440732}
abc7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0
7:18PM DBG Checking characteristic status
7:18PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0
7:20PM DBG Checking characteristic status
7:20PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0
7:20PM DBG Checking characteristic status
7:20PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0
^C7:24PM DBG Received done signal func=WatchMotion
I looked in the config file in etc and metrics were set to disable. Running with `ITD_LOGGING_LEVEL=debug` Logs this once I start the watch command and nothing when it exits using Ctl-C ``` 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0 ``` When the `itd` daemon (Not the `itctl watch` command) exits, it logs: ``` 7:24PM DBG Received done signal func=WatchMotion ``` Here is the entire log: ``` 7:18PM DBG InfiniTime device found in list mac=F9:5F:F9:ED:09:0F 7:18PM DBG Resolved characteristic name= uuid=00001532-1212-efde-1523-785feabcd123 7:18PM DBG Resolved characteristic name= uuid=00000001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Resolved characteristic name="New Alert" uuid=00002a46-0000-1000-8000-00805f9b34fb 7:18PM DBG Resolved characteristic name="Battery Level" uuid=00002a19-0000-1000-8000-00805f9b34fb 7:18PM DBG Resolved characteristic name="Notification Event" uuid=00020001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Resolved characteristic name= uuid=00000003-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Resolved characteristic name="Step Count" uuid=00030001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Resolved characteristic name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Resolved characteristic name="Filesystem Version" uuid=adaf0100-4669-6c65-5472-616e73666572 7:18PM DBG Resolved characteristic name="Heart Rate" uuid=00002a37-0000-1000-8000-00805f9b34fb 7:18PM DBG Resolved characteristic name= uuid=00000005-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Resolved characteristic name="Filesystem Transfer" uuid=adaf0200-4669-6c65-5472-616e73666572 7:18PM DBG Resolved characteristic name= uuid=00001531-1212-efde-1523-785feabcd123 7:18PM DBG Resolved characteristic name="Current Time" uuid=00002a2b-0000-1000-8000-00805f9b34fb 7:18PM DBG Resolved characteristic name= uuid=00000002-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Resolved characteristic name="Firmware Version" uuid=00002a26-0000-1000-8000-00805f9b34fb 7:18PM DBG Resolved characteristic name= uuid=00000004-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Resolved characteristic name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Firmware Version" uuid=00002a26-0000-1000-8000-00805f9b34fb 7:18PM INF Connected to InfiniTime version=1.11.0 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="New Alert" uuid=00002a46-0000-1000-8000-00805f9b34fb 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Current Time" uuid=00002a2b-0000-1000-8000-00805f9b34fb 7:18PM INF Initialized InfiniTime music controls 7:18PM INF Relaying calls to InfiniTime 7:18PM INF Relaying notifications to InfiniTime 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Filesystem Transfer" uuid=adaf0200-4669-6c65-5472-616e73666572 7:18PM INF Started control socket path=/tmp/itd/socket 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Adding weather event event={"DewPoint":6,"EventType":3,"Expires":3600,"Temperature":790,"Timestamp":1670440731} 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Adding weather event event={"Amount":0,"EventType":1,"Expires":3600,"Timestamp":1670440731,"Type":0} 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Adding weather event event={"DirectionMax":21,"DirectionMin":21,"EventType":2,"Expires":3600,"SpeedMax":1,"SpeedMin":1,"Timestamp":1670440731} 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Adding weather event event={"Amount":22,"EventType":8,"Expires":3600,"Timestamp":1670440731} 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Adding weather event event={"EventType":9,"Expires":3600,"Humidity":87,"Timestamp":1670440731} 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Weather Data" uuid=00040001-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Adding weather event event={"EventType":6,"Expires":3600,"Pressure":1019,"Timestamp":1670440732} abc7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0 7:18PM DBG Checking characteristic status 7:18PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0 7:20PM DBG Checking characteristic status 7:20PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0 7:20PM DBG Checking characteristic status 7:20PM DBG Characteristic available name="Motion Values" uuid=00030002-78fc-48fe-8e23-433b3a1942d0 ^C7:24PM DBG Received done signal func=WatchMotion ```
Owner

Interesting. Ctrl+C in itctl should've canceled the context and that in turn should've sent the done signal to ITD. Yeah, if ITD never got the done signal, then it makes sense why it never stopped. I'll have to look into why it's not being sent.

Interesting. Ctrl+C in `itctl` should've canceled the context and that in turn should've sent the done signal to ITD. Yeah, if ITD never got the done signal, then it makes sense why it never stopped. I'll have to look into why it's not being sent.
Owner

This should be fixed in the latest commit of itd and itctl (you need to update both because the socket protocol has changed). Can you please test it?

This should be fixed in the latest commit of `itd` and `itctl` (you need to update both because the socket protocol has changed). Can you please test it?
Owner

I'm going to close this due to inactivity, but it should be working fine now.

I'm going to close this due to inactivity, but it should be working fine now.
Sign in to join this conversation.
No description provided.