Update channel loop bug #26

Closed
opened 2025-12-29 01:20:19 +01:00 by adam · 8 comments
Owner

Originally created by @busimus on GitHub (Aug 25, 2021).

Originally assigned to: @kradalby on GitHub.

I noticed that headscale v0.7.0 enters a loop sometimes – it constantly receives requests for update and checks that the client is up to date. It snaps out of it a minute later.
I'm attaching a log (with slight modifications) of the entire process from program start to the loop ending. And bisecting the repo led me to find the offending commit: 88d7ac04bf

hs_88d7ac04b_bug.log

Originally created by @busimus on GitHub (Aug 25, 2021). Originally assigned to: @kradalby on GitHub. I noticed that headscale v0.7.0 enters a loop sometimes – it constantly receives requests for update and checks that the client is up to date. It snaps out of it a minute later. I'm attaching a log (with slight modifications) of the entire process from program start to the loop ending. And bisecting the repo led me to find the offending commit: 88d7ac04bf7a78f378cd3015c1b1bb083ba54cb3 [hs_88d7ac04b_bug.log](https://github.com/juanfont/headscale/files/7046105/hs_88d7ac04b_bug.log)
adam closed this issue 2025-12-29 01:20:19 +01:00
Author
Owner

@jsiebens commented on GitHub (Sep 9, 2021):

for the record, I've seen the same behaviour, causing high CPU usage during the loop

@jsiebens commented on GitHub (Sep 9, 2021): for the record, I've seen the same behaviour, causing high CPU usage during the loop
Author
Owner

@kradalby commented on GitHub (Sep 14, 2021):

I think I have noticed this as well, I will take a dive into it.

Based on the PR from that commit, it has ended up being a trade off of ensuring clients are up to date vs not getting all updates. For the time being I would say its better, but I will dive into it when I have some time.

I suspect its a timing and channel/lock issue.

@kradalby commented on GitHub (Sep 14, 2021): I think I have noticed this as well, I will take a dive into it. Based on the PR from that commit, it has ended up being a trade off of ensuring clients are up to date vs not getting all updates. For the time being I would say its better, but I will dive into it when I have some time. I suspect its a timing and channel/lock issue.
Author
Owner

@kradalby commented on GitHub (Oct 2, 2021):

@busimus @jsiebens Hi, I am sure there is something, and that it is causing high cpu load, but I am struggling to see the loop in the example log provided.

The updates, and the "check if update is necessary" seem to be working as intended. I will agree that the update is somewhat aggressive, but I have not managed to spot the loop.

I might have read the wrong parts of the log, since it is quite comprehensive, would you manage to give me some pointers to how you understand it?

Meanwhile, I'll have a think if it can be made a bit less aggressive.

@kradalby commented on GitHub (Oct 2, 2021): @busimus @jsiebens Hi, I am sure there is something, and that it is causing high cpu load, but I am struggling to see the loop in the example log provided. The updates, and the "check if update is necessary" seem to be working as intended. I will agree that the update is somewhat aggressive, but I have not managed to spot the loop. I might have read the wrong parts of the log, since it is quite comprehensive, would you manage to give me some pointers to how you understand it? Meanwhile, I'll have a think if it can be made a bit less aggressive.
Author
Owner

@busimus commented on GitHub (Oct 2, 2021):

I truncated most of the loop and replaced it with ..., but I left a few iterations of the repeating five lines before and after that (e.g. lines from 220 to 224).

@busimus commented on GitHub (Oct 2, 2021): I truncated most of the loop and replaced it with `...`, but I left a few iterations of the repeating five lines before and after that (e.g. lines from 220 to 224).
Author
Owner

@kradalby commented on GitHub (Oct 2, 2021):

Thats the stupidest I have been in a long time, I hit the wrong key and did not scroll far enough down 🤦‍♀️

@kradalby commented on GitHub (Oct 2, 2021): Thats the stupidest I have been in a long time, I hit the wrong key and did not scroll far enough down 🤦‍♀️
Author
Owner

@kradalby commented on GitHub (Oct 6, 2021):

I think this is resolved in #142, could any of you take it for a spin?

@kradalby commented on GitHub (Oct 6, 2021): I think this is resolved in #142, could any of you take it for a spin?
Author
Owner

@busimus commented on GitHub (Oct 6, 2021):

Yep, doesn't happen anymore with that PR.

@busimus commented on GitHub (Oct 6, 2021): Yep, doesn't happen anymore with that PR.
Author
Owner

@kradalby commented on GitHub (Oct 7, 2021):

Fixed in Main

@kradalby commented on GitHub (Oct 7, 2021): Fixed in Main
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#26