Heisenbugs and the Diabetes Observer Effect

Warner Heisenberg

Night 1: wake up in the night with my continuous glucose monitor (CGM) barking at me. Measure my blood sugar– 189. Ugh. Too tired. I take 1 unit of insulin, and go back to sleep, only to be woken up several hours later by my CGM again. Measure my blood sugar. 57. Ugh. Eight grams of carbohydrates to correct. Brush my teeth again. Sleep again.

Night 2: wake up in the night with my CGM barking at me. Measure my blood sugar– 205. Ugh. Take .7 units of insulin, knowing the 1 unit from last night was too much. Above 200 mg/dL, I try to stay awake to make sure my blood sugar goes back down. It takes an hour. A long, tired hour of checking every few minutes only to see I’m still above 200. Finally, a 180. Back to sleep. Wake up an hour later, my CGM barking again. Still high. Take another .4 units of insulin. Sleep. Another hour. Barking. High. Measure. 191. Seriously? Another .7 units. Wake up in the morning at 75 mg/dL.

Night 3: expecting to go up again at night, I take extra insulin with dinner. Hanging around with the hubby, and bam, I’m 47 before I feel it. Eat 12 grams of carbs, suspend my basal insulin. Wait. Go back up to 72. Reenable my insulin, continue about my business. I’m 75 before going to bed. I leave it be. Wake up in the night with my CGM barking. 181. Ugh. Last night took more than a unit and a half to get back down; I hedge, and take 1.1 units. Wake up several hours later with my CGM barking again. 60. It’s only an hour until I wake up for real, and I don’t want to eat and brush again. Suspend my basal for half an hour, and wake up an hour later at 59. Close enough.

But what’s going on here? Besides the fact that all of the sudden I’m going straight up at night (that happens for a week at a time occasionally. Hormones?), my required correction bolus is all over the map. I needed way more insulin on night 2 than nights 1 and 3, clearly. Why? What makes this night different than all other nights? (Yes, that is a Passover shout-out.)

And then it occurs to me: it looks like a heisenbug.

A what? A heisenbug. The word heisenbug comes from software engineering, where it was coined to name a bug (or error) in software that can’t be easily debugged because the act of trying to observe the bug changes its behavior. The term is a pun derived from the name of Werner Heisenberg, who described the “observer effect” in quantum mechanics, in which the act of observing a process fundamentally changes the process.

With computers, heisenbugs are rare occurrences; software is designed to execute a series of operations, and doesn’t care about who’s watching it. There are peculiar cases, though, where trying to add code to debug a problem seems to change or even fix the problem. Consider a case where two processes are failing because they compete for the same resources on the computer. You don’t know why the processes are failing, so you add some code to print out status messages as the processes run. The act of printing out messages, though, causes the programs to run at slightly different rates, and so both are able to finish without ever running into each other. Magically, trying to observe the two processes seems to make the problem go away, even though it does not address any actual functioning of the processes. A heisenbug.

But people are not like computers, and it occurred to me after these three nights that we are full of heisenbugs, diabetics especially so. Any process that involves hormones or emotions, it seems, is necessarily at risk of introducing heisenbugs. For example, imagine that you are feeling arbitrarily sad, so you start recording the events in your life at the end of the day, to try to track down what is causing this malaise. Lo and behold, the act of reflecting on your day proves to be a clarifying habit, and after a week you feel much more optimistic and happy, without ever having found a single “cause” for your feelings. A heisenbug.

Similarly, imagine my blood sugar is high in the middle of the night. I administer insulin according to previous experience to try to bring it back down, and, like a good little diabetic, I wait up and observe the downward arc to make sure everything is going to plan. However, it’s the middle of the night, and my body was not ready to be awake. It’s in a bit of a shock, starts releasing some cocktail of hormones and brain-juices to keep me awake. And so my previous hyperglycemic experience is now a fundamentally different experience, as in trying to observe this bout of hyperglycemia, I have changed some number of variables. What I found the other night no longer applies, because I am observing this particular night, and that changes my activity levels and hormones, and that changes my body’s response.

A bloody heisenbug.

So what do I do next time? I can’t just start going to sleep above 200 and assume all will be okay– what if there is a real issue like a blocked set? And I’d rather not stay up for an hour every time I wake up in the night and have to take a correction bolus.

There is a fairly straightforward solution in this particular case– if I plan to stay up, recognize I will likely need more insulin to combat a sort of middle-of-the-night-dawn-phenomenon, but that if I go right back to sleep, I should take less insulin.

But that doesn’t solve the bigger problem– that diabetes is a complicated mess of problems and bug reports that requires an awful set of ad hoc rules and memory space to keep functional.

In conclusion, I would like a cure, please.

Or, a more immediately practical alternate conclusion: keep an eye out for heisenbugs, and adjust your debugging behavior accordingly.

Notify of
1 Comment
oldest most voted
Inline Feedbacks
View all comments
Laura G.
Laura G.
10 years ago

Yes yes! I was muttering angrily about Heisenberg myself the first time I wore that old doctor-administered Medtronic CGM which kept BG records the patient could not see. My furious logging and careful food weighing during the 3-day wear period wiped out my usual methods of estimating everything and destroyed my usual daily patterns, rendering the experiment useless. 

Learning the word “Heisenbug” has made my day. Thank you!

Copyright © 2009-2021 Diabetes Media Foundation, All Rights Reserved.
ASweetLife™ is a trademark of the Diabetes Media Foundation, All Rights Reserved.
Would love your thoughts, please comment.x