13 ms·
Infinite loop in macOS Night Shift in the summer near the Arctic Circle
- lb1lf 7y agoMy old Garmin eTrek something-or-the-other had a feature which would compute local sunrise and -set. It threw a fit and rebooted when I asked it for sunset while at 78 degrees north in June.
- cstross 7y agoThe perils of living on a spinning oblate sphere strike again! Software would be so much simpler on a ringworld ...
- echeese 7y agoOr an infinite frictionless plane in a vacuum
- cmroanirgo 7y agoOr a discworld, sitting on the back of four elephants who are standing on the back of a turtle.
- jmull 7y agoWhat does the turtle stand on?
- connor4312 7y agoIt's turtles all the way down.
- a3n 7y agoIt floats in space. Let's not get crazy.
- bobsil1 7y agoThe Turtle Moves
- fortran77 7y agoThis is due mainly to our tilt, not our sphere-ness
- dougmwne 7y agoOn a spherical world with no tilt, what time is sunrise at the north pole?
- vorticalbox 7y agoYou're right, we need to straighten the earth up.
- gberger 7y ago'Falsehoods programmers believe about time: - Every day has a sunrise and a sunset'
- rosser 7y agoRight? I am reliably put into this weird emotional state of being simultaneously entertained and chagrined at the propensity for technologists (and I very much include myself in this criticism) to make these kinds of assumptions, and the edge-case bugs that fall out of them.
- danaliv 7y agoAnd it's a reminder that "edge case" is relative. It's not an edge case for people who live there!
- gubbrora 7y agoIf we tried to get these thing 100% right we'd not have time for anything else. Punting is pragmatic.
- rosser 7y agoYou're absolutely right that "100% right" is an unreasonable standard. I submit that knowing that there are places on the planet where, at times, the sun doesn't set, however, is a reasonable thing to expect of someone who's made it far enough in life to be writing code (or testing it! How did this pass QA?) for Apple. f.lux gets it right if I set my zip to Barrow, AK. Why can't Apple, with how many orders of magnitude more resources at their disposal — including knowledge?
- gubbrora 7y agoAgreed
- vortico 7y agoIt exists, it's just complex-valued.
- cold_fact 7y agoreminds of the Computerphile Tom Scott video "The Problem with Time & Timezones" https://www.youtube.com/watch?v=-5wpm-gesOY https://www.youtube.com/watch?v=-5wpm-gesOY and why I will never implement datetime myself
- a3n 7y agoNobody ever got fired for using the provided datetime.
- robertAngst 7y agoWhat is the standard for using datetime libraries? Use the one that comes with each language, or use some UTC library?
- dekhn 7y agonow that's a great test case that could easily be tested using mocks.
- bdamm 7y agoMy favorite part of "To the Moon and Back" is when the NASA administrator is explaining to Congress that the three astronauts on board Apollo 1 died because "We weren't creative enough to imagine this could happen."
- bsimpson 7y agoThe capitalization in the title made me originally parse this as about Apple's former headquarters (https://en.wikipedia.org/wiki/Apple_Campus https://en.wikipedia.org/wiki/Apple_Campus).
- randartie 7y agoAm I the only person who is impressed with this person's debugging skill?
- uxp 7y agoNot really. All he's shown is a behavior (high CPU) and is equating it with the latitude he's at. When he turns off Night Shift, the daemon process for the feature stops consuming as much CPU, from what I gathered. Nowhere does he provide evidence that there is an infinite loop calculating the sunrise/sunset. And I really don't want to be a stereotypical poster by simply degrading what he did, so I will give credit to him for knowing where to look and making a hypothesis that is not wrong. He's perfectly on point to _begin_ a debugging process, but I can't see he's found a bug. He's found an unexpected or undesired behavior. I certainly would consider this story/tweet as a huge plus if he were being interviewed by me for an engineering position, but it appears he's already well above my pay grade anyways.
- ALittleLight 7y agoWhat's the difference between unexpected and undesired behavior and a bug?
- IAmEveryone 7y agoYou’re splitting hairs and failing at it. They have clearly found a “bug” if Night Shift is consuming 100% CPU without end, even if their hypothesis for the reason might be wrong.
- Zekio 7y agohmm I wonder if it also applies in the other direction where the sun doesn't rise for a part of the year as well
- sovande 7y ago> where the sun doesn't rise for a part of the year as well That would be the same place a few months from now. This is strange though, it's not like this guy is the first above the polar circle using a Mac. I suspect it must somehow be related to him being a tourist with a different region and timezone settings or maybe the location services got confused.
- pier25 7y agoIt happens in the best of families
- SergeAx 7y agoI wonder if Apple shares that code in iOS too?
- saagarjha 7y agoCoreBrightness is similar across the platforms.
- sudhirj 7y agoMaybe, but I don’t think there’s a CoreSunrise or CoreSunset. The problem isn’t in setting the brightness or colour tone, it’s calculation when to switch between them.
- saagarjha 7y agoiOS and macOS share GeoServices, which performs the actual calculation of sunrise/sunset times (among other things).
- DonHopkins 7y agoHas anyone ever determined how many times you have to drive around Infinite Loop before Apple Security calls the police on you?
- ashton314 7y agoI had a friend who once drove around a traffic circle as many times as he could. He got up to 39 times before a police officer pulled him over. Does anybody know if there is a law on that?
- jedberg 7y agoDepends on the state/country, but most have rule that you can't go around more than once. In fact, most places I've seen in the US you can't even go more than 3/4s around (although I'm not sure if that's a law or just a posted suggestion).
- mantap 7y agoWhat the hell? What if you miss your turning or want to do a u-turn? Going around more than once is a perfectly reasonable thing to do.
- gpvos 7y agoOn a turbo roundabout, you can't. https://en.wikipedia.org/wiki/Roundabout#Turbo_roundabouts https://en.wikipedia.org/wiki/Roundabout#Turbo_roundabouts
- cheerlessbog 7y agoWhat if it's a magic roundabout? [1] [1] https://en.m.wikipedia.org/wiki/Magic_Roundabout_(Swindon) https://en.m.wikipedia.org/wiki/Magic_Roundabout_(Swindon)
- DonHopkins 7y agoIt looks like a pinball machine with bumpers and flippers!
- simongr3dal 7y agoWould this be a bug in the Night Shift feature, or something more fundamental, i.e. something in Apple's Foundation library?
- fest 7y agoI sometimes wonder how many bugs are lurking in systems using GPS for navigation at 180th meridian (where longitude goes from 180 to -180).
- Symbiote 7y agoI crossed the antimeridian several times on a trip last year. I usually carry a GPS logger on such trips, to contribute to OpenStreetMap. My USB logger was OK, but my backup logging apps both added crazy points around the world. Programs to display / edit the tracks also had bugs. Even Google Maps has defects on the maps at the antimeridian.
- harshreality 7y agoThe F-22 had such problems. https://www.defenseindustrydaily.com/f22-squadron-shot-down-by-the-international-date-line-03087/ https://www.defenseindustrydaily.com/f22-squadron-shot-down-...
- fest 7y agoWhen I was working on geo-fencing feature for a small UAV I did see the consequences of naive maths when working with coordinates near antimeridian (e.g. calculating a perpendicular vector of a fence segment). Also related- it seems crazy to me how some teams are working on a robotic product without building/interating a simulator first!
- danaliv 7y agoIIRC there was a bug in an early version of a certain fighter jet where it would go inverted when crossing the equator. Oops.
- macintux 7y agoUrban legend or so it would appear. https://www.ar15.com/forums/general/Urban_legend_about_F16___true_or_bunk_/5-154222/ https://www.ar15.com/forums/general/Urban_legend_about_F16__...?
- jedberg 7y agoDeep in the twitter replies: > Now, is this a corner case, an edge case or a boundary case? And does the answer depend on whether you are a flat-earther or not? That was too funny.
- zaszrespawned 7y agoPersonally I believe that earth is flat disk carried by 4 elephants, which are standing on the back of a giant turtle
- baxtr 7y agoYou’re wrong. I know for a fact that there are 7 elephants, one of them is white.
- Farradfahren 7y agoOne for each continental plate? Adding explenation power and prediction to flat earth science. Its good science, if it can be used to predict and test against ;)
- mirimir 7y agoSure, but that turtle is carried by four "elephants, which are standing on the back of a giant turtle". And that turtle ...
- deleted 7y ago[deleted]
- TeffenEllis 7y agoI really wish people would find true enlightenment. It's obvious a turtle in space wouldn't need anything underneath -- because turtles swim!
- mirimir 7y agoSure. But really, it's all illusion. So better just unask the question.
- supernova87a 7y agoPerhaps it's because they implemented the "Sunrise equation" naively, which becomes indeterminate for high latitudes when the Sun is close to the maximum? https://en.wikipedia.org/wiki/Sunrise_equation https://en.wikipedia.org/wiki/Sunrise_equation cos(\Omega) = - tan(\phi) x tan(\delta) Where \Omega = hour angle (sunrise, sunset offset from noon), \phi = latitude, \delta = sun declination. Clearly if the right hand side gets big enough (>1), this doesn't work.
- pcwalton 7y agoNever knew about that equation! That's cool. Angles are always such a pain. In my experience it's worth applying trigonometric identities and working in terms of unit vectors, sines, and cosines instead of using angles directly. In this case angles seem unavoidable, though: acos(tan(x)*tan(y)) doesn't simplify to anything useful.
- ccrush 7y agoIt's omega = acos( - tan(x) * tan(y)), not that that makes much of a difference.
- JetSpiegel 7y agoThe Suntimes Android app (its on F-Droid) correctly reports None for such high latitudes.
- deleted 7y ago[deleted]
- mrbill 7y agoReminds me of an early release build of Win95. It would properly set time back an hour for Daylight Saving Time, but not set a flag that it had been done, so it would do it over, and over, and over...
- fishywang 7y agoSemi-related, I noticed that Google handled this case in the weather part during my last year's summer visit of Utqiagvik, AK: https://twitter.com/fishywang/status/1013931269363658754 https://twitter.com/fishywang/status/1013931269363658754
- ufo 7y agoDoes anyone know how other similar programs behave in these latitudes? For example, f.lux, GNOME's night light, or Redshift?
- Farradfahren 7y agoIf you are very certain, do a step back and add a option to circumvent your certainty with a manual option. It will be certainly useful.
- adim86 7y agoThis is a beautiful example of the importance of diversity on a team. I have no idea how diverse the team is and I am not speaking of racial or sex diversity... this is the core of the discussion, having people with varying life experiences prevent obvious bugs like this or innovative ideas that no one person could think about. This is a fun bug
- INTPenis 7y agoMy thinking was rather that they made an assumption. Which is a much simpler explanation because people make faulty assumptions every day. But yeah, diversity would have helped.
- inanepenguin 7y agoI believe the first portion of your reply directly supports the original comment here. Everyone's assumptions are based off of their experiences. A diversity of experiences and backgrounds creates an environment where assumptions are challenged more frequently. The more than a team can support their decisions through facts, instead of assumptions, the stronger their solutions will be.
- catacombs 7y ago> I am not speaking of racial or sex diversity I was about to wonder how racial and sex diversity plays into a program running into an infinite loop.
- chrstphrknwtn 7y agoWhilst that’s true, I think it’s also a good example of how shortsighted most attempts at diversity are; in this case a Scandinavian would perhaps have the “diverse experience” to preempt a naïve implementation of a sunrise fiction, however diversity seems to always be about race or sex or identity, which seems to miss the point somewhat. Edit: Which is to say that a male with fair hair and skin and a university education wouldn’t qualify as diverse in most contemporary conceptions of diverse, despite a likely underlying diversity of culture and experience.