PermaLinkSome Lessons Learned From The 8.5.1 getDocumentByKey Regression
09:40:43 PM

As mentioned previously, the bug that Erik Brooks described here and here is not really limited to 8.5.1, and as Erik also pointed out, it is not just affecting getDocumentByKey, but listing all the releases and all the affected functions would make for an unwieldy article title, so I took a shortcut. Shortcuts are ok in blog titles. They're very often not ok, however, in code. So here are some lessons about shortcuts in code that my experience dealing with this bug has reminded me about.


Lesson 1: Exceptions that "can't happen" can happen How many times have you come to a place in your code and said to yourself, "if we made it to this point, the database is known to be good, the view is known to be good, the document is known to be good, the item is known to exist, so... nothing can go wrong". I've already actually blogged about a surprising case where this particular scenario can be false, but the getDocumentByKey regression bug is more of a classic case of a "can't happen" exception that really can happen. When the database is known to be good, and the view is known to be good, conventional wisdom holds that getDocumentsByKey won't throw an exception, yet now we know it can throw an error due to an 'invalid collection'


Corollary 1a: Paranoid error checking is good and Corollary 1b: Not checking for "can't happen" errors is a dangerous shortcut I'm reasonably happy with the level of paranoid error checking that I instinctively do in my production code, and the same is true for the members of my product team. I'm not perfectly paranoid, by any means, but in all of the cases in our product's code where the 8.5.1 getDocumentByKey regression might rear its head, there is in fact a try... catch block in close proximity to the lookup code.


Lesson 2: Every lookup operation can have three distinct outcomes The first outcome, and the one that we usually have foremost in our mind when we code a lookup, is success. Failure, though, is always an option. In fact, failure is two options. There is a difference between "lookup failure" and "failure to lookup". In many cases it is perfectly safe to treat these two cases the same way, typically because you're only ever doing lookups for documents that your application always expects to exist, so both failures are unexpected. In a context where you're doing a lookup for a document that might or might not exist, however, "lookup failure" and "failure to lookup" should be treated differently. For a lookup failure, you've proven that the document does not exist and you can take the action appropriate for your application -- possibly creating a new document. For a failure to lookup, on the other hand, you still don't know whether the document exists or does not, and at this point you're almost certainly better off aborting whatever you were trying to do.


Corollary 2a: Paranoid error checking needs to handle 'Failure To Lookup', not 'Lookup Failure' and Corollary 2b: catch(NotesException e) { result = null } may be a dangerous shortcut. In the Domino object model, lookup failure gives you a null result, and exceptions occur on failure to lookup. This is something that even seasoned Domino professionals may not recall off the top of their head, or they may be lulled into compacency by 15 years of never having actually seen a failure to lookup situation when the view is valid. If your application logic really should treat the two distinct failure cases the same way, then it's ok to put a try... catch around your lookup and have the catch block simply set the result to null, but using this as a pattern for all cases, however, is bad, bad, bad! That's reflexive "can't happen" thinking in action. You have to think about your application logic. If your application can't continue processing the current operation normally without definitively knowing whether the document you were looking for exists or not, then your catch block probably ought to throw an exception that will go up the chain, unwind (and recycle!) things properly, and then either abort the application altogether or move on to another operation that doesn't depend on knowledge about the particular document you had been looking for.


Lesson 3: Murphy's Law says that if you slip up on Lessons 1 and 2 just once in a huge code base, a Domino regression that turns a "can't happen" exception into a "does happen" exception will be disclosed a few weeks before you are scheduled to ship a major release of your code Sigh.

This page has been accessed 467 times. .
Comments :v

1. ninest12304/23/2016 04:46:46 AM


http://www.oakleyvault.us.com/
http://www.oakley--sunglasses.com.co/
http://www.oakleysunglassesoutlet.us.org/
http://www.oakleysunglasses.us.com/
http://www.oakleysunglasses.com.co/
http://www.rayban-sunglass.us.com/
http://www.ray-ban-sunglass.us.com/
http://www.rayban--sunglasses.org/
http://www.polo-ralph-lauren.us.com/
http://www.polo-ralph-lauren-outlet.us.com/
http://www.burberry-outlet-store.us.com/
http://www.burberryoutlet-store.us.com/
http://www.michaelkors-outlet-online.us.org/
http://www.outletonline-michaelkors.com/
http://www.michaelkors-outlet-online.us.com/
http://www.michael-korsoutlet.in.net/
http://www.michaelkors-outlet-store.us.com/
http://www.michaelkors-handbags.in.net/
http://www.uggs-outletboots.in.net/
http://www.uggsoutlet.us.com/
http://www.uggs-outlet.in.net/
http://www.cheapuggboots.in.net/
http://www.cheap-uggs.in.net/
http://www.louisvuitonoutlet.us.com/
http://www.louisvuitton-outlets.org/
http://www.louisvuitton.ar.com/
http://www.louisvuitton-outlet-store.com/
http://www.louis-vuittonhandbags.org/
http://www.redbottoms.in.net/
http://www.christianlouboutin-outlet.in.net/
http://www.christian-louboutin-shoes.in.net/
http://www.christian-louboutin.org.uk/
http://www.rolexreplicawatches.us.com/
http://www.replica--watches.com/
http://www.air-jordanshoes.net/
http://www.nike--outlet.com/
http://www.toryburch-outletonline.in.net/
http://www.guccioutlet-online.us.com/
http://www.prada-handbags.us.com/
http://www.prada-outlets.in.net/
http://www.longchamp-outlet.in.net/
http://www.longchamphandbags.in.net/
http://www.longchamphandbagsoutlet.us.com/
http://www.tiffany-and-co.us.com/
http://www.tiffanyjewelry.us.com/
http://www.nikeairmaxinc.net/
http://www.nikeair-max.net/
http://www.nike-freerun.com/
http://www.chanel-handbags-outlet.in.net/
http://www.katespadeoutlets.cc/
http://www.katespade-handbags.in.net/
http://www.coachoutlet-online.in.net/
http://www.coachfactory-outletonline.in.net/
http://www.coachoutletstoreonline.jp.net/
http://www.coachpurse.in.net/
http://www.true-religionoutlet.in.net/
http://www.truereligionjeansoutlet.us.com/
http://www.truereligionoutlets.in.net/
http://www.cheaptruereligion.us.com/
http://www.nike-airmax-pas-cher.fr/
http://www.nikeair-max.fr/
http://www.airjordanpas-cher.fr/
http://www.nikefreerun.fr/
http://www.nike-roshe-run.fr/
http://www.sac-longchamp-pas-cher.fr/
http://www.sac--longchamps.fr/
http://www.poloralphlauren-pascher.fr/
http://www.louboutin-pas-chere.fr/
http://www.sac-michaelkors-pascher.fr/
http://www.sac-burberry-pascher.fr/
http://www.lunette-oakley-pascher.fr/
http://www.lunette-rayban-pas-cher.fr/
http://www.hollister-abercrombiefitch.fr/
http://www.sachermes.fr/
http://www.vanspas-cher.fr/
http://www.timberland-paschere.fr/
http://www.newbalancesoldes.fr/
http://www.converse-pas-cher.fr/
http://www.the-north-face.fr/
http://www.niketnrequin-pascher.fr/
http://www.polo-lacoste-pascher.fr/
http://www.nikeblazerpaschere.fr/
http://www.nikeair-force.fr/
http://www.sac-guesspascher.fr/
http://www.sac-vanessa-bruno.fr/
http://www.scarpehogan--outlet.it/
http://www.rayban-sunglasses.me.uk/
http://www.michaelkorshandbags-uk.org.uk/
http://www.michaelkors-outlet-canada.ca/
http://www.michael--korsoutlet.ca/
http://www.lululemon-outlet-canada.ca/
http://www.hollistersale.org.uk/
http://www.thenorth--face.co.uk/
http://www.mulberryhandbagsoutlet.co.uk/
http://www.ralphlauren-outlet.co.uk/
http://www.nike--airmax.co.uk/
http://www.nikeairmax.org.uk/
http://www.nike-free-run.org.uk/
http://www.abercrombie-and-fitch.org.uk/
http://www.nike-roshe-run.org.uk/
http://www.nike-trainers.org.uk/
http://www.nike-air-huarache.co.uk/
http://www.longchampbags.org.uk/
http://www.hollister-abercrombie.es/
http://www.vans-shoes-outlet.com/
http://www.nikerosherun.net/
http://www.maccosmeticsoutlet.us/
http://www.abercrombie-andfitch.us.com/
http://www.hermesbirkinbags.com.co/
http://www.the-northfaceoutlet.us.com/
http://www.the-north-face.in.net/
http://www.newbalance-shoes.in.net/
http://www.reebok-outlet.in.net/
http://www.lululemonoutlets.in.net/
http://www.cheap-nfljersey.in.net/
http://www.cheap-wedding-dresses.org/
http://www.beatsbydrdreheadphones.in.net/
http://www.montblanc-pens.us.com/
http://www.ferragamo-shoes.net/
http://www.giuseppe-zanotti.in.net/
http://www.instylerionicstyler.us.com/
http://www.babyliss.in.net/
http://www.mcm-handbags.net/
http://www.chiflatiron.cn.com/
http://www.insanityworkout.in.net/
http://www.ghdhair-straighteners.org.uk/
http://www.bottegaveneta-handbagsoutlet.com/
http://www.valentino-shoes.us.com/
http://www.herveleger.us/
http://www.asicso.com/
http://www.soccer--shoes.net/
http://www.soccerjerseys.com.co/
http://www.celine-handbags.org/
http://www.p90x3workout.us.com/
http://www.jimmychoo-shoes.us.com/
http://www.hollister-clothingstore.us.com/




2. Coach Outlet03/14/2017 05:16:03 AM
Homepage: http://www.coachsoutlet.us.com


kate spade handbags http://www.katespadesoutlet.us
coach factory outlet http://www.coachoutletonline.cc
Coach Outlet Store Online http://www.coachoutletstore.in.net
Michael Kors Outlet http://www.michaelkorsoutletstore.eu.com
polo outlet http://www.outletralphlauren.in.net
Polo Ralph Lauren Outlet Store http://www.polosoutlet.us.com
yeezy boost 350 http://www.yeezyadidasboost.us.com
Red Bottom Shoes http://www.redbottomsshoe.us.com
adidas nmd http://www.nmdadidasshoes.us.com
Christian Louboutin Outlet http://www.christianlouboutinsshoes.us.com
true religion outlet http://www.outlettruereligionjeans.us.com
true religion jeans outlet http://www.true-religionjeans.com
Pandora Jewelry http://www.pandorajewelrysale.us
Ferragamo Shoes http://www.ferragamoshoes.eu.com
North Face Jackets http://www.thenorthfaces.us.com
Polo Ralph Lauren Outlet http://www.poloralphlaurenus.us.com
kate spade outlet http://www.outletkatespade.us.com
Ray Ban Sunglasses http://www.raybanoutlet.cc
Coach Outlet Store Online http://www.coachsoutlet.us.com/
Coach Factory Outlet Online http://www.coachoutletonlines.us.org/
Coach Outlet Online http://www.coachfactoryoutletstore.eu.com/
Coach Outlet http://www.coachsoutletonline.us.com/
Michael Kor Factory Outlet http://www.michaelkorsmk.us.com/
Michael Kors Outlet Online http://www.michaelkorsoutleto.us.com/
Michael Kors Outlet http://www.michaelkorsofficials.us.com/
Michael Kors Factory Outlet Online http://www.michaelkorsoutletstoreofficial.eu.com/
michael kors outlet http://www.michaelkorsofficial.in.net
Coach Outlet Clearance http://www.coachoutletstoreonline.net
Michael Kors Online http://www.michaelkorsonline.eu.com
Coach Outlet online http://www.coachoutletcoach.us.com
Michael Kors Outlet Online http://www.outlet-michaelkors.us
nike shoes http://www.nikeairmax90.us.com
nike outlet http://www.nikeshoes.us.org
cheap Jordan http://www.jordancheap.us
retro jordan shoes http://www.jordanshoe.us.com
tory burch outlet http://www.outlet-toryburch.in.net
tory burch sale http://www.tory-burch-outlet.us.com
oakley outlet online http://www.oakleyoutlet.ca
cheap oakley sungalsses http://www.oakleysunglasses-outlet.in.net
ray ban outlet online http://www.raybanoutlet.com.co
ray ban sunglasses outlet http://www.rayban-sunglassesoutlet.in.net
coach outlet http://www.coachoutletstoreus.us.com
the north face outlet http://www.thenorthfaces.name
Michael Kors Bags http://www.michaelkorsoutlets.us.org
Coach Factory Outlet http://www.coachfactoryoutletofficial.name
north face jackets http://www.northfacejacketsoutlet.com
Coach Outlet http://www.coachfactoryoutletstore.us




Enter Comments^


Email addresses provided are not made available on this site.





You can use UUB Code in your posts.

[b]bold[/b]  [i]italic[/i]  [u]underline[/u]  [s]strikethrough[/s]

URL's will be automatically converted to Links


:-x :cry: :laugh: :-( :cool: :huh: :-) :angry: :-D ;-) :-p :grin: :rolleyes: :-\ :emb: :lips: :-o
bold italic underline Strikethrough





Remember me    

Monthly Archive
Responses Elsewhere



About The Schwartz

rss.jpg


All opinions expressed here are my own, and do not represent positions of my employer.