5 ms·
This used to happen to my MacBook Pro, although it was a non Apple Silicon one. The issue was that I had changed the DHCP lease time on my router from the defau
by pauljara 1y ago
This used to happen to my MacBook Pro, although it was a non Apple Silicon one. The issue was that I had changed the DHCP lease time on my router from the default to a really low value. I believe I had set it to 15 minutes. What I believe was happening was the MBP was waking up to renew its IP address every 15 minutes and by the time it went to sleep again, it was probably waking back up to repeat the process. Changing the value on the router back to its default completely fixed the battery drain issue on my MacBook Pro. I'd never have guessed the cause-effect except I made the change around the same time I purchased that new MacBook Pro and was paying more attention to any issues that might arise.
- ThePowerOfFuet 1y ago> I had changed the DHCP lease time on my router from the default to a really low value. I believe I had set it to 15 minutes. What were you hoping to achieve by doing that?
- mlyle 1y agoI like low lease times. DHCP server knows what's really on the network, and if something requests lots and lots of the pool you'll be fine in 15-30 minutes. If things are set to a really long time, >=12 hours, you find out the next day when everything is broken (or you get alerts in the middle of the night). If you set them to a randomized 15-90m span, you get things breaking immediately when you screw up the dhcp server.
- cruffle_duffle 1y agoHah. Your answer just has more questions. What on earth is requesting so many DHCP leases?
- mlyle 1y agoYou've never accidentally spun something up that consumes all the leases? It's just been a couple of times, but I've definitely done it (e.g. bridged a couple of networks that shouldn't have been). But mostly, it's the other two things: it provides me with a list of hosts active now, and if the DHCP server is subtly broken I get a sentinel signal of something being wrong earlier (and it tends to be a partial instead of complete failure). One more bonus: if I move something to a static lease, out of the pool, it'll renumber in a reasonable time and I don't need to go kick link state to get it to request again. Things like really big caches and really long lease times: They're good for average performance, and they can let you ride out small problems. The flip side is that they tend to mask problems and to create really big demand transients at times. The trick is always to find a good middle ground.
- ncr100 1y agoExcellent answer - new appreciation for low lease times, thank you
- ThePowerOfFuet 1y agoYeah, there's a lot of room to play between 900 and 86400 seconds. Extremes of any sort generally aren't good. You fucked around and you found that out.
- mlyle 1y ago> You fucked around and you found that out. I haven't had any notable issues with values in the 600-1200 second range, actually. (My macs don't wakeup to keepalive network on battery, though).
- esseph 1y agoModern devices will randomize MAC unless told not to when connecting / reconnecting to a wifi/Ethernet network. When on a pretty standard /24 network subnet, if there are more than a few dozen devices coming and going, the lease table can fill up until older lease reservations expire.
- pauljara 1y agoI was trying to determine if a lease expired, if my router would immediately try to lease that same IP out to another machine on the network. It felt like it cached an expired lease mapping and would try to keep that old IP un-leased in case the original machine to which it was mapped came back online. I was just trying to better understand the behaviour.
- bigthymer 1y agoDid you want certain IPs to be fixed to certain devices or do you prefer they be randomly allocated?
- pauljara 1y agoNeither really, though my ISP's router would allow me to assign IPs by MAC address so they're effectively reserved to a device. The router's web UI displayed a list of devices. I wanted to see if devices would start dropping off this list as soon as the DHCP lease time expired. When they did drop off this list, I had thought they reappeared with the same IP without me explicitly using the reservation functionality. So how was this happening? I figured the web UI might not be showing the full picture of all the data about devices; that the router held records of formerly connected devices beyond the DHCP lease time for some unknown reason.
- sneak 1y agoThis is a macOS bug; it doesn’t need an IP address while it’s asleep. Waking up to renew a DHCP lease is crazy. Closed source OSes are such a bane.
- DJBunnies 1y agoThat’s a little obtuse. Macs can still poll for certain messages while they’re asleep (Power Nap.)
- mschuster91 1y ago> This is a macOS bug; it doesn’t need an IP address while it’s asleep. Waking up to renew a DHCP lease is crazy. It's actually not. As a user I'd expect the device to wake up and still have the same IP address via a continuation of the lease. Yes, the correct way would be a longer lived DHCP lease, but el-cheapo ISP routers often lock down such settings.
- amelius 1y agoThis is a good point (running processes might break if the IP address suddenly changed after wake-up). However, why should the renewal process take on the order of 15 minutes? And why would it require a complete wake up?
- ryandrake 1y agoInteresting, as a different user, I'd expect the opposite: If my computer is "asleep" I don't expect it to do anything, and it shouldn't be able to wake itself up.
- evan_ 1y agothat's called "off".
- scarby2 1y agoi suppose we have come to expect 4 states: - off: no power, no activity - hibernate: no power, no activity session state saved to non-volatile storage - sleep: Minimal power, RAM remains powered with the session state, can be resumed quickly - on now we essentially have sleep++ and no option to set it back to vanilla sleep.
- p_ing 1y agoA functional DHCP client will request renewal of it's IP address 50% of the way through the lease, so it was probably worse than you thought.
- cruffle_duffle 1y agoThat is so weird. How much mAh can a single “wake and renew lease” possibly take? Like it has to be milliamp-milliseconds (mAmS?). I mean my phone is chattering with the cell network probably all the time even in a fairly deep sleep mode. The laptop is lighting up the WiFi stack to send and receive (and process) like a few packets? Like you said though, it’s pre Apple silicon so who really knows! Maybe it decided to do some other stuff while it was awake?
- p_ing 1y agoIt may stay on longer than the amount of time it takes to renew. Perhaps for every wake it stays on for 60 seconds; it is also doing other things like checking mail.
- cruffle_duffle 1y agoI wonder if some user-space process lights up and throws a wrench in things. I’m sure both Microsoft and Apple have entire teams with incredibly full backlogs dealing with power management. And I’m sure half their time is spent dealing with “messes” caused by other teams doing wild and crazy (but somehow theoretically useful) shit. It’s clearly not an easy problem.
- bayindirh 1y agoYour cell phone modem is completely decoupled from the main processor and is a complete, independent system in itself, so it's optimized to do that. Bluetooth and WiFi radios on Macs are also semi-independent. They can keep connections alive while the system is in deep sleep. Waking a big processor, frequency scaling it and turning it off is surprisingly complicated. We disabled SpeedStep in our clusters since frequency scaling visibly affected performance of the systems due to overhead incurred by frequency change. Same is true for waking / sleeping big silicon. It's complicated, it's wasteful. Some of the Intel's biggest improvements as their micro-architecture evolved were reduction of the frequency scaling overhead and its performance impact, but this never made the news back in the day because its effect was invisible in consumer class systems even in its most primitive form. > Maybe it decided to do some other stuff while it was awake? That's called Power Nap and is enabled only if your computer is connected to power, by default.
- spearman 1y agoWoah just found out my router (mikrotik) defaults to 10 minute lease durations.
- evulhotdog 1y agoMine defaults to 24h on RouterOS 7.16.x.