It appears that some programmers think that Windows already ships with that time machine the Research division is working on

There are some compatibility bugs we investigate where the root cause is that the application relied on time travel. Wait, let me explain.

An application might issue an asynchronous request for a file to be renamed before they create the file itself. The program happened to work because it took time for the request to get scheduled and reach the file system, and that delay gave the application time to put the file on the disk just in time for the rename operation to see it.

Another example is an application which installs a shortcut onto the Start menu that points to a file that they haven't installed yet. The installer happened to work because it took time for the Start menu to notice that a new shortcut was created, and by the time it went looking at the shortcut, the installer had copied the target into place.

Okay, so maybe it's not so much a time machine as a race condition, but the inherent problem is that the application wanted to do some operation that was dependent on a prerequisite, but issued the operations in the wrong order, and they were relying on the fact that they could get the prerequisite done before the operation even noticed the problem.

It's like writing a check with insufficient funds,¹ hoping that you can deposit money into the account before the check is cashed. If the check-cashing process ever gets optimized (say, by using electronic check presentation), your sneaky trick will stop working and your check will bounce.

Now, the developer of the application probably wasn't consciously relying on this race condition, but they never noticed the problem during internal testing because they managed always to win the race. (Or maybe they did notice the problem during internal testing, but since it was sporadic, they chalked it up to "unreproducible failures".)

In the case of the file renaming operation, losing the race condition means that the original file hangs around on the disk without being renamed. In the case of the shortcut, it means that your shortcut appears on the Start menu with a blank icon.

If you have one operation that relies upon the successful completion of a previous operation, it would be in your best interest to wait for the previous operation to complete before issuing the dependent operation.

¹ As technologically advanced as the United States purports to be, it is still quite common that payments between parties are made by sending little pieces of paper back and forth. For those who live in genuinely technologically advanced countries to whom the idea of sending pieces of paper is rather quaint, here's how it works in the United States.

The original model for checks is simple.

  • Alice has an account at Alligator Bank and wishes to send $10 to Bob.
  • Alice writes a check, which is a piece of paper that says roughly "I authorize Alligator Bank to pay $10 from my account to Bob."
  • Alice sends the check to Bob.
  • Bob goes to Alligator Bank and presents the check, along with proof that he is Bob.
  • Alligator Bank confirms the check's validity, deducts $10 from Alice's account, and gives Bob $10. (If this step fails, the check is said to have bounced.)
  • Alligator Bank stamps paid on the check and gives it back to Alice as confirmation that the payment occurred.

It's inconvenient for Bob to have to go to Alligator Bank to get his money, but he can ask his bank to do it for him.

  • Bob has an account at Bunny Bank.
  • Bob goes to Bunny Bank and presents the check, along with proof that he is Bob.
  • Bunny Bank sends the check to Alligator Bank demanding payment.
  • Alligator Bank confirms the check's validity, deducts $10 from Alice's account, and sends $10 to Bunny Bank.
  • Bunny Bank credits $10 to Bob's account.

Over the decades, there have been tweaks to the above process, but the basic system remains in place.

  • Instead of an O() algorithm (where each bank contacts each other bank), the system uses an O(n) algorithm (where each bank contacts a central clearinghouse, which then redistributes the checks).
  • Bunny Bank credits Bob's account before receiving confirmation from Alligator Bank that the check is valid.
  • Check images are sent between banks instead of physical checks.

There is a category of scams that take advantage of the second detail. I'll leave you to read about them yourself.

Electronic presentation is an alternative process wherein the information on the check is used to create an electronic payment, which is processed almost immediately, and the original check is never processed as a check.

Comments (41)
  1. henke37 says:

    Aw, Consto and Woodgrove didn't get their product placement.

  2. Tony says:

    Why is it bad to create a shortcut to something non-existent? You can reach the same state by creating a shortcut to something, the deleting the something.

    [Sure, but why would a setup program want to create a broken shortcut? -Raymond]
  3. Anon says:

    It is bad to create a shortcut to something nonexistent for the same reason it is bad to create a road that leads directly off a cliff.

  4. Skyborne says:

    As a defense against check fraud scams, Salamander Bank doesn't credit more than $50 of a check before receiving confirmation from the bank it's drawn on.  If it's particularly large or suspicious, they do not credit at all and impose an extra three-day waiting period to be sure the authorization doesn't get revoked.

  5. John Ludlow says:

    Or a pointer in memory to something that doesn't exist…

    The Start menu will sometimes query a file to determine things about it so it can correctly populate the menu entries – the icon, for example.

    Also, when an entry appears in the start menu, a user expects to be able to click it. If you click an entry in the start menu and the entry happens to point to something that doesn't exist, the start menu will offer to clean that up for you, so then you'd have no shortcut.

    Race conditions can involve many different scenarios (usually we talk about things like one thread trying to access some in-memory data before the other thread has initialized it), and they're pretty much always (AFAIK) asynchronous. These bugs can be difficult to track down because they're difficult to reproduce because the next time you run the application the CPU may decide to schedule things differently, altering the results of the race.

  6. James says:

    @Anon indeed – one time vacationing in Gran Canaria, we took a hirecar on an island tour, driving round the coast, then inland to take in some of the views from the top of the volcano. The rental company provided us with a map of the island, which indicated that there was a road from close to the summit southward, back to the resort we were staying in, and we figured we'd take this route back.

    Turns out the map designer had followed this pattern, and added the road to the map before it had actually been, well, paved. There was a dirt track cut down the mountain, but no 'road' per se.

    Didn't quite take us off a cliff, but certainly a more interesting drive back than we'd anticipated, or than the little euro hatchback was really designed to handle…

  7. Tim says:

    This reminds me of the installer for a certain angry avian app that creates shortcuts that look for the icon in the installer instead of the actual installed program. And that installer exists in the temp directory, so when a certain OCD individual clears out his temp directory, the app shortcut no longer has an icon. I'm constantly editing that shortcut to point back to the installed program to fix the icon.

  8. You can still use archaic cheques in the UK, but you have to go out of your way to get them nowadays.  My bank no longer issues cheque guarantee cards at all, nor gives you a cheque book; you can still ask for a cheque book, but without the guarantee cards no business will accept them (not that any want to anymore).

  9. A comment says:

    Installing a start menu link to something that doesn't exist yet makes sense if your program is just a helper or frontend for another program, but you want to leave users the liberty of installing in the "wrong" order (i.e.: Install the helper before the actual program). The helper may keep a link to the core program in its start menu group to start it with certain arguments.

    A common example would be a latex editor for a latex compiler. I remember I installed in the "wrong" order and it still worked.

    [Congratulations, you beat the race condition. I wouldn't risk doing it again. You might not win next time. -Raymond]
  10. Gabe says:

    I can't tell if this is an article about race conditions with a really long footnote or an article about check cashing with a Windows-related MacGuffin!

  11. Ross Presser says:

    Neither. It's a snark about developer practices AND about the payment habits of one of the largest economies in the world.

  12. DWalker says:

    I will write a check to hire some developers so that time machine can be worked on.  I promise there are funds in my account to pay the check.  :-)

  13. > If you have one operation that relies upon the successful completion of a previous operation, it would be in your best interest to wait for the previous operation to complete before issuing the dependent operation.

    It's not always that simple :). I remember, we had once the situation where Directory.CreateDirectory() would successfully return, Directory.Exists() would return true, but writing to such directory would not work due to it thinking directory didn't exist. Furthermore, it was only happening on Windows 8, and we couldn't reproduce the issue on neither Windows XP, Windows 7 or OS X. We "worked around" it by sleeping for 50 ms after creating the directory, and never reproduced the issue again.

    I wonder though, is it possible to actually make sure directory creation actually completes?

    [Did you disable your anti-virus software? Those things tend to hook a lot of file operations and result in "impossible" things. -Raymond]
  14. Cesar says:

    @A comment: isn't that what MSI's "advertised shortcuts" are for? They allow you to create a Start Menu shortcut for an executable which hasn't been installed yet.

  15. Ken Hagan says:

    These race conditions sound like things that would usually work on a uniprocessor machine. You'd issue the request but you'd be allowed to finish your time slice before the scheduler handed over to whatever might process the request. It's been a while since uniprocessors were common, but the requirements for things like installers haven't changed much might so the implementation might include some very old code. Of course, once in a while your time-slice would end sooner than you expected. That would be one of the "unreproducible failures" Raymond speculates about.

  16. Nico says:


    I feel the same way about debit cards, but checks are just as bad.  Those two little numbers printed on the bottom of every check are enough to empty your account, and getting your money back can be an absolute nightmare.  Cash on-hand for small transactions and a couple of credit cards for the rest seem to work pretty well.

    I have no deep love of credit cards (something about merchant fees really rubs me the wrong way), but at least you have solid consumer protection laws.  And, when fraud occurs, it's the credit card company's money that's been taken so they're a lot more interested in getting it back.

  17. poizan42 says:

    I sense a plothole here! If Microsoft research are working on a time machine, then why wouldn't they use it to go back in time and add it to earlier windows versions?

    More on topic (albeit tentatively): Using RemoveDirectory has a tendency to produce races even if done in the correct order. Especially creating a directory if it doesn't exists is dangerous because RemoveDirectory is asyncrounous and won't remove the directory before the last handle is closed, but CreateDirectory apparently won't remove the "marked for delete" flag. This can get really nasty if you have some task that attempt to clean up after itself, and it's called twice in quick succession.

  18. Klimax says:

    @Myria: How about wire transfer? (Fun fact: here we have 9 millions of debit cards, 1 million  of credit cards, bulk of money transfers in wire transfers (~65%) and no checks and IIRC they were never used after 2. World War. Didn't find much on pre-war use, but it seems not much even then)

  19. Joshua says:

    > shortcut to program … not installed yet … with known arguments

    [Congratulations, you beat the race condition. I wouldn't risk doing it again. You might not win next time. -Raymond]

    You can remove this particular race by installing an .ico file for the shortcut to reference. However there probably isn't a guarantee of the program being installed in the path you expect, so this is less of a good idea than it sounds.

  20. ErikF says:

    @henke37: Sadly it appears that Woodgrove Bank has gone under (its Twitter feed is still up but doesn't resolve to any host.) Hopefully Humongous Insurance ( has a better business model!

  21. Joker_vD says:

    > The alternative is worse.

    Let me tell you what alternative way is used in one reportedly outdated country. To pay you water/light/whatever bills, you take the bills, go to the nearest post office and pay them, with cash, or with a debit card. To get your salary paid, you tell the employer your bank account when you're hired, and they just transfer money there at the end of every month. Or, more popular option, they just open a new account in the bank they find convenient on your name, and hand you its requisites and the associated debit card (also, the employer has to sort out and pay your income taxes for you, so you receive your salary with taxes already deducted from it). And to pay someone you can either give them cash, or go to your bank and transfer money from your account to his.

    Not the most convenient way, but it still gets the things done.

  22. morlamweb says:

    The use of sophisticated technology systems for payments instead of "little pieces of paper" depends on the willingness of both parties to accept the system.  All of my bills are paid through online accounts linked to my bank accounts.  Bills get paid by electronic transfer from my accounts.  No pieces of paper required.  The one exception is my rent payment.  I spoke with the landlords some time ago about using an online payment processor to transfer the rent from my account to theirs.  The normal system is to write them a "little piece of paper" every month, tape it to our door, and they drive out here to pick it up.  It's inconvenient for all involved.  Initial discussions seemed promising; they had an account with the payment processor, as did we, so it would be simple to transfer the money regularly for the rent.  In case we forget one moth, no problem; just logon to the web service and transfer the money.  Well, a couple weeks after the initial conversation, we got word they do not want to use the online service for the rent.  They wanted us to write out checks because that's they way it was always done.  So, there are people out the who use more sophisticated means of money transfer, but it really requires the acceptance of both parties.

  23. Myria says:

    > [Did you disable your anti-virus software? Those things tend to hook a lot of file operations and result in "impossible" things. -Raymond]

    Oh god, tell me about it.  The anti-virus our security team makes us use causes Visual Studio builds to fail all the time.  link.exe finishes making a new .exe file, and the anti-virus goes, "OMG, new .exe written!  I must scan it!".  Then Visual Studio runs mt.exe to embed the manifest into the new .exe's resource section, but the .exe is locked by the anti-virus program, so mt.exe fails.

    It's as if anti-virus companies haven't heard of oplocks (…/aa365433(v=vs.85).aspx ).  Meanwhile, Microsoft's anti-virus, Windows Defender, of course works fine.

    > As technologically advanced as the United States purports to be, it is still quite common that payments between parties are made by sending little pieces of paper back and forth.

    The alternative is worse.  Paying bills by mail would pretty much have to be done by debit card otherwise.  (Or credit card, but how would you pay credit card bills?)  Debit cards are *extremely* dangerous; I never use mine except at my bank's ATM.  I never want to give any company direct access to my bank account.  Online transactions have been repeatedly cracked, so that's no good, either.

  24. Cesar says:

    > The alternative is worse. Paying bills by mail would pretty much have to be done by debit card otherwise.

    Here in Brazil, a very common alternative is to pay via Boleto Bancário (…/Boleto_banc%C3%A1rio). The bill comes in a standardized format (see the image at that Wikipedia article for an example), with a barcode and a "typeable line" (that long string of numbers at the top), which is a rearrangement of the barcode data with a few extra check digits.

    The fixed-length barcode has a set of fixed fields (bank number, due date, bill value, checksum) and a bank-defined field. The bank-defined field has enough information for the bank to identify the account which should receive the payment, and also a unique number to identify the bill.

    To pay a bill with this system, you can go to your bank's ATM and scan the barcode (or type the numbers if your inkjet printer has smudged the barcode), go to your bank's cashier (which will do the same thing), use your online banking (usually typing the numbers, but there are USB devices to scan the barcode for you), or even pay at a lotérica. Your bank looks up the target bank (it's the first three digits of the barcode) and sends it the money; the receiving bank interprets the bank-defined field to know where to put the money.

    On the other side, the one who emitted the bill will receive from his bank a machine-readable file with all the boletos paid that day. The information includes the unique number, so he can identify who paid the bill.

    (I could bore you all to tears with arcane details of the boleto barcode format; I had to implement boleto generation and return file parsing at work.)

  25. Cesar says:


    > Those two little numbers printed on the bottom of every check are enough to empty your account

    From what I've read around the Internet, that worry seems to be unique to the USA. I haven't seen anyone from any other country worried that writing someone a cheque would give the recipient information enough to withdraw funds from one's account.

  26. @Raymond: I didn't, but this issue (our program reportedly failing to do a certain operation with exception pointing to that place) was reported by our customer, and although this issue did only occur once in 50 times, we reproduced it on many different machines (running fresh Windows 8.1 installs too, so only anti virus was Windows Defender). It would not have been practical solution even if it did solve it: we can't ask our customers to disable their AV :).

  27. Lars says:

    @Myria: In Germany we use direct debit. The customer gives the retailer/landlord/service provider/etc. an authorization that he can charge your bank account and the amount due is directly transferred from the customers bank account to the bank account of the other party. To prevent fraud, the customer can charge back the money for 45 days. Similar the salary is also directly deposited in your own bank account by your employer and taxes and insurances are already deducted from the deposited value; so what you get is what you can spent without any surprises. The system works quiet well and fraud is very minimal. Due to this system, credit cards for daily shopping are also a rarity. Most people use either cash or a direct debit card.

  28. Dave says:

    That explanation of how cheques work is actually quite useful, I ran into this exact problem when I moved to the US to work a few years ago.  When I opened a bank account, the bank gave me a small box full of chequebooks. My reactions were (a) what am I going to do with all these cheques, and (b) how do you fill out a cheque.  I had to do some googling to find pictures of completed sample cheques to figure out what you were supposed to do with them, since I'd never used one of these things before.  It was also the first time in my life I'd received a paycheque, an actual physical piece of paper that I had to take to the bank rather than being paid by direct electronic deposit.

  29. boogaloo says:

    @Chris Crowther Everytime I open a bank account they ask if I want a cheque book, they probably hope that people say no. The banks wanted to get rid of cheques but they realised they'd need to replace them with something that was effectively a cheque. There are several reasons why I prefer to use cheques for some transactions, although for others I use bank transfers.

    "You can still use archaic cheques in the UK, but you have to go out of your way to get them nowadays.  My bank no longer issues cheque guarantee cards at all, nor gives you a cheque book; you can still ask for a cheque book, but without the guarantee cards no business will accept them (not that any want to anymore)."

    Fraud with electronic payments is just as easy. In the UK we don't have to sign for anything when using cards now, which was more about removing your ability to say "that is not my signature" than reducing the amount of fraud. They picked a less secure system on purpose and then sold it to their customers as a 100% secure system, "I'm sorry but you must have lent your card to someone and given them your pin".

  30. boogaloo says:

    @Lars In the UK there is absolutely no way I'd choose to use a debit card for shopping. Our consumer credit laws protect us from having to pay back loans for goods that turn out to be faulty, or that we never receive. The card issuer is jointly liable with the person you buy from.

    Also by not having to pay back the money for at least 30 days without having to pay interest, it can sit in my account earning interest. Some credit card companies offer interest free up to 23 months when you open a new credit card, some even give you a cut of the transaction processing fee as well. I once made the equivalent of 400 euros in a year just by spending money on a credit card (the money to pay it off was saved in a high interest account and there were other perks with the card). I have a card that gives more cash back on fuel purchases than they charge the retailer, probably hoping that I'll use it for other transactions where they aren't so generous (but I don't).

    "Due to this system, credit cards for daily shopping are also a rarity. Most people use either cash or a direct debit card."

    But UK banking is strange, I have some current accounts that pay a higher rate of interest than any saving account available. I've just "earned" £125 by opening another current account. If the banks make a mistake and you bother to complain then you can make money out of them that way too, they even refund the cost of the phone call without checking if you actually had to pay for it yourself.

  31. Evan says:

    @morlamweb: "The one exception is my rent payment."

    Rent was the second-to-last clinger-on for me. For four years I lived in a largeish complex with office on-site, so paying by check was as simple as walking 100 yards to the office and sticking it into the mail slot. Then for a year I had to mail it. But then I bought a house, and I got a mortgage from my credit union, so I just pay electronically out of the account I already have with them.

    The last clinger-on was actually private music lessons from an independent teacher, but we both have accounts from the same credit union and they offer an easy person-to-person transfer service (it may work to/from other banks too, but I'm not sure), so even that's electronic now.

    I think it's been about a year since my last check?

  32. Dave says:

    @Myria: Tell me about *#(7R* AV software… our software has special code in it to detect a range of crazy, can-never-happen networking errors and scan memory for the names of various A/V product DLLs.  If they find them, they report the "networking problem" as being A/V software screwing things up rather than an actual error.  Unfortunately in recent years this has become less useful because A/V vendors are going to virus-like ends to hide the presence of their products…

  33. Another cheque tale says:

    I'd like to get out of using cheques (I live in the Southwestern US) but guy who mows my lawn, my maid and our local school (field trip fees etc.) don't accept anything else.

  34. Erik F says:

    @Fleet Command: Oh noes! A blog posting that doesn't use footnotes correctly! Also, a blog posting that uses rhetorical devices! The end of the world is nigh! Could it be that Raymond isn't a robot? (…/453614.aspx)

  35. Mr. Chen, there is a reason a footnote is called a *foot*note not middlenote. If you put it in the middle, you might as well put it into parentheses. Footnotes should appear at the bottom of the pages separated by a <hr> or modern HTML5 equivalent.

    Also, "It appears that some programmers think" is a personal attack; "Windows does not ships with that fabled time machine!" would do admirably well.

  36. Anon says:

    @Erik F: There are other ways of not being a robot besides being despicable. You are not a robot though. I am sure of that.

  37. @Evan: ROFL! Hehe, that was precious. It seems I didn't make my point clearly; in fact I was very vague and unclear. The footnote mark appear in the middle of what appears to be one article. Footnotes need to have a less conspicuous formatting, be short and have a separator separating them from the rest of the article. When the footnote is bigger than the main article, it is a sign that it is not the suitable device.

    But forget the footnotes; personal comments are far more important.

  38. Evan says:

    @Fleet Command: 'If you put it in the middle'

    It's *not* in the middle, it's just a very long footnote.

  39. @Fleet Command: Were this a formal article being posted in a magazine or periodical, sure.  Blogs are typically meant for a more casual audience, though, so one usually can forgive such trespasses.  Also I've seen some academic publications where the footnotes ended up taking up more of the page than the actual content.  Much more annoying there.

  40. Scarlet Manuka says:

    In Australia, cheques are available but rarely used. (We used them much more often when I was first married, 18 years ago; we also used to do the "pay most bills with cash at the post office" thing then.) These days I pay all my bills online. I think the last time I used a cheque was for a payment to a pest control company, two or three years ago.

    We have a system here known as "BPAY", where each bill has two numeric codes on it; the first identifies the biller, the second is a reference number for the specific bill. In most cases a biller will use the same reference number for all their bills to a given account, but some billers use a varying reference number. When I log into my bank and go to the bill payment area, it has a list of all my saved BPAY billers (including the reference number for the ones that don't change it; it knows which ones do, and doesn't save the reference number for them). So I just select the source account, select the biller from my saved list, tell it how much, and press the button. (I do always check the numbers first, just in case a biller decides to change things up and doesn't tell us.) Almost every bill I get is covered by this system – even the high school my older kids go to has BPAY billing.

    For people who aren't on the BPAY register, I can send money to any Australian bank account. I pay for the newspaper delivery service and my daughter's dance lessons this way. I also do my home loan repayments this way (since my loan is with a different bank from my other accounts – originally I had a loan at the same bank, then it was just a simple inter-account transfer.) There are a couple of reference fields which can be used to specify account or customer details in whatever way the biller wants.

    It's all directed from my bank's site, so it's very simple and convenient – it takes me about 10 minutes to pay all the bills every fortnight, and that's only because my wife insists on having printed lodgement receipts for all our payments. And to mess with my settings someone would have to already have access to my bank accounts, in which case airtight hatchway.

  41. foo says:

    Also related to movement in time, the clocks just fell back an hour in some Australian states on the weekend. Possibly other parts of Asia Pacific as well, but I'm not sure. Scary stuff: (DST movie trailer)

Comments are closed.

Skip to main content