← Back to context

Comment by chrismorgan

4 years ago

A fair fraction of the bad batteries I have seen have not behaved like this. Things like immediate power failure on disconnecting AC power, or claiming to be at 30% and then dying, or denying the existence of the battery altogether (two of these have happened to me personally—one at the ripe age of four months rather than due to age—and three or four to other family members). It’s certainly more common for them to just fade fairly rapidly to zero and die there, but it’s by no means rare for them to spontaneously fall over.

We're talking different timescales here. All you need is one second or so to command the NVMe controller to flush, and killing other power consumers in the mean time would buy you more time by reducing load, possibly even giving you several minutes the way batteries work (they tend to fall over under load when defective/dead). What may visually appear as power suddenly failing isn't necessarily so at the scale of voltage threshold interrupts and PMICs.

What usually happens is battery internal resistance is too high to sustain a given power load, so once load crosses a threshold the system goes into a spiral of doom increasing current as battery voltage decreases and you end up in a shutdown. That's the "30% and suddenly 0% or a shutdown" scenario. But if you catch it before it's too late, you can just stop consuming power and let the NVMe controller flush.

  • The case I have in mind where it would suddenly die around 30% would happen around that point regardless of load, even asleep, after following a sufficiently typically linear discharge curve up to that point. Maybe the power management system gets a fraction of a second’s notice, I don’t know; but it wasn’t a 30% plummeting to zero over the course of ten or thirty seconds, or even a “30%; no—0%; no—dead” case, which seem to be the much more common failure modes. As for the “pull the AC power and it instantly dies” cases, I’m a layman in battery matters, with no more than high school electronics, but I’d be surprised if there’s enough in there for it to do anything—those are cases where either it literally has no battery to draw on (because it’s electronically dead), or thinks it has a battery but discovers as soon as it tries to draw on it that it effectively doesn’t actually.

    • If it's literally dying at 30% with no warning, it's either the battery polling being too slow (keep in mind the UI will usually only refresh once a minute or so for these things; the power management system has faster stats), or the charge estimation being way off. There's very little reason for a battery to drop from true 30% SoC to completely dead, without first going into a power draw spiral of doom which you can revert if you stop consuming as much power.

    • My personal experience with 3 Apple devices:

      “30% to 0” and “Pull AC and it instantly dies” are typically a combination of load and device temperature. High CPU/GPU usage, high brightness, 3G/LTE usage, and cold temps and the device doesn’t have a chance.

      It’s been somewhat fascinating to monitor power usage in this really crude way. TikTok on iOS, for example, uses so much power that it’s the most likely to cause the device to shut off. FB Messenger is in the top 5. Some of Apple’s background processes will also cause it, as will paging memory to disk.

      There’s another bit of information that will not surprise many people on HN: high-amperage charging will cause the battery percentage to be “more wrong”. Devices will report 45% or higher and still die as if they were reporting 30%. Charging at 500mA will not only make it “more correct”, but will typically mean that a device will not suddenly die until it’s in the single digits.

      This is still n=1 of course.