Didn't see that coming



  •  One of our older website reports errors by sending me an email. Even if the error is that it couldn't send an email. So today I came in and found an email from the sales department about a couple of order notifications that they never received from the site. Right below that I had a second email from the website itself. The contents:

    Page *****: Failed to send us an order notification
    email (ref: 1170598)

     

    Holy crap, it actually worked...



  •  If the email address it sends the errors to is different from the email it sends the order notifications to, then I understand why this was done, as the error could be that the destination mailbox was full, or the server refused the email, and from your post, it seems that this is the case. 

     So wheres the WTF? 



  • @Mole said:

     So wheres the WTF? 

     

     

    The WTF? It was sent to that e-mail address...



  • @Mole said:

    So wheres the WTF?
    That error recovery code actually recovered from an error.

    A Play for Civil Defense Moron, Schoolchild, Nuclear Weapon, and Us:

    CivD: Remember, when you see the flash, Duck and Cover!
    Kid: Okay!
    CivD: mutters Stupid moron, if there's a nuke this building's going to be torn and burned to ashy shreds; ducking and covering is not gonna save anyone.
    Nuke: flash
    CivD: OH SHI- runs
    Kid: ducks covers
    Nuke: boooom
    CivD: melts
    Several minutes pass...
    Kid: Woohoo! I'm okay, perfectly fine! Hey, what's that man-shaped outline on the wall?
    Us: WTF???



  • @Evo said:

    The WTF? It was sent to that e-mail address...

    Not according to his message. He describes it as the notifications are sent to the sales team (and they noticed some missing and emailed him), whereas the error emails are sent to him only. His email could be on a completely different domain (unlikely, but can happen), so it makes sense.



  •  A couple of clarifications... both our emails are on the same domain. Also this particular error is triggered if php's mail() function returns false. It's basically if(!mail(<blah>)) mail(<error>); It takes an Infinite Improbability Drive to make this code work.



  • @DOA said:

    A couple of clarifications... both our emails are on the same domain. Also this particular error is triggered if php's mail() function returns false. It's basically if(!mail(<blah>)) mail(<error>); It takes an Infinite Improbability Drive to make this code work.
    Ah! Now it all makes sense. I could understand it if it was more like "if (!mail(foo)) logerror(bar)", and logerror was used throughout the program and also mailed  you a copy of the error (as it wouldn't know then that mail had failed). 

    I'm not 100% sure how mail() works on php, so I'll leave it there. 



  • @DOA said:

    A couple of clarifications... both our emails are on the same domain. Also this particular error is triggered if php's mail() function returns false. It's basically if(!mail(<blah>)) mail(<error>); It takes an Infinite Improbability Drive to make this code work.

    It's naive code, but it's not that improbable.  mail() can fail for a variety of temporary reasons that would be resolved by the second call to mail().  As I said, relying on this to report an error shows a naive understanding of error handling, as it is likely whatever caused mail() to fail the first time will also cause it to fail a second.  However, it's not that unlikely that the second call to mail() would work, if temporary network or mail daemon issues were cleared up by the time the second call was made.  If the error is temporary the failure is likely to be triggered by a timeout of some sort, so there may be a significant amount of time passing between the two calls during which the initial cause of failure clears up.  So it's WTFy to expect the second call to reliably deliver the error message, but not WTFy for it to actually be delivered. 



  • So you have mail admins who are quick enough to intuit that there is an error after the first mail() fails and then implement a fix in the 5 nanoseconds before the log_error() calls mail() again?



  • @Qwerty said:

    So you have mail admins who are quick enough to intuit that there is an error after the first mail() fails and then implement a fix in the 5 nanoseconds before the log_error() calls mail() again?

    TRWTF is that this is just one big race condition? 



  • @morbiuswilters said:

    If the error is temporary the failure is likely to be triggered by a timeout of some sort, so there may be a significant amount of time passing between the two calls during which the initial cause of failure clears up.

     

    @Qwerty said:

    So you have mail admins who are quick
    enough to intuit that there is an error after the first mail() fails
    and then implement a fix in the 5 nanoseconds before the log_error()
    calls mail() again?

    The Real WTF is not reading posts to the end. But anyway, I think he was more talking about problems that "resolve themselves" automatically without intervention of the mail admin. Like full mail queues or something similar.

     



  • @PSWorx said:

    @morbiuswilters said:

    If the error is temporary the failure is likely to be triggered by a timeout of some sort, so there may be a significant amount of time passing between the two calls during which the initial cause of failure clears up.

     

    @Qwerty said:

    So you have mail admins who are quick
    enough to intuit that there is an error after the first mail() fails
    and then implement a fix in the 5 nanoseconds before the log_error()
    calls mail() again?

    The Real WTF is not reading posts to the end. But anyway, I think he was more talking about problems that "resolve themselves" automatically without intervention of the mail admin. Like full mail queues or something similar.

    Or a high load average or a network blip or failover on a load balancer or...

     

    Basically, there are many ways that a system might experience temporary failures that are resolved in ways that don't require direct intervention of a sysadmin within "5 nanoseconds".  I'm shocked by the ignorance displayed in his reply, honestly. 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.