New macOS Bug - will occur every 49 days, 17 hours, 2 minutes, 47 seconds

https://appleinsider.com/articles/26/04/09/unless-you-reboot-every-once-in-a-while-your-mac-will-get-kicked-offline-every-49-days

Unless you reboot every once in a while, your Mac will get kicked offline every 49 days

In a lengthy blog post detailing the bug, Photon explains that affected Macs can no longer establish new TCP connections. TCP connections are the backbone of computer networking — without them, the Mac’s network interfaces can no longer function.

In its simplest form, the issue is caused by the way macOS’s XNU kernel handles time. Your Mac tracks how long it has been running, and the time resets when it’s powered off or restarted.

The problem is that Apple’s XNU kernel stores this time as a 32-bit unsigned integer that can hold values from 0 to 4,294,967,295. After that, the value wraps around, starting again from zero. This happens after 49 days, 17 hours, two minutes, and 47 seconds.

While this is expected behavior, it has an unintended knock-on effect on the way macOS closes old TCP connections. After keeping connections alive for a short period after use, macOS uses the XNU kernel’s TCP timestamp to decide whether to close them.

The link to the blog post with more details explains the exact reason, which comes down to this:

The XNU kernel stores its TCP timestamp as a uint32_t counting milliseconds since boot. 2³² milliseconds = 49 days, 17 hours, 2 minutes, and 47.296 seconds. After that, the counter wraps back to zero. What happens next is the subject of this post.

3 Likes

As noted by some in the article comments, while I generally reboot once week or two, there has been longer times in the past, but I didn’t see when this bug popped up…

But, like the old Unix based WeCo electronic switching systems (ESS), they weren’t meant to reboot, ever, really, we would do updates, software or hardware on the offline side of it’s duplex processors, switch into it, do the other side, and then the system would do millions of audits to synchronize the two sides, but ni intention to be powered down in what was supposed to be it’s 50 year lifespan, however, technology changes meant they never had to live up to that expectation.

But, yes an interesting tidbit… Likely few of us consider things like this…

1 Like