• WHO WANTS TO KNOW (unregistered) in reply to dave

    WRONG!  Microsoft THEMSELVES says they have the SAME bug!  It is NOT related to UNIX, it is POSIX!!!! 

    BTW At least it wasn't MILLISECONDS, or NANOseconds, as SOME claim to use.

    Steve

  • Akimoto (unregistered) in reply to Reed

    Anonymous:
    "There is no easy way to do "sleep for x seconds" other than to add x to the current time to determine the wakup time"

    huh?

    int main(int argc, char** argv) {
       time_t duration = (time_t) atol(argv[1]);
       time_t start = time(NULL);
       for(;;) {
         time_t now = time(NULL);
         if( (now - start) >= duration)
           return 0;
      }
    }

     

    HUH?

     

    Man! Stop and think a little

    (now - start) >= duration is equivalent to now  >= duration + start

    so you end up adding start time and duration.

    Regards

  • Akimoto (unregistered) in reply to robymus
    robymus:

    Actually, i don't see the point in the sleep there. But if it is required (for any reason unknown to me), i don't think it is intented to ever end. So why not using:

    while true; do sleep 1; done; 

    (more expert shell-magic also possible :)

     

    Do you want to melt down the CPU?

  • Unforgiven (unregistered) in reply to lucky luke

    The most stupid things I ever seen were done by very graduated idiots. Please dont attack self-taugh people, this has nothing to do with professional quality.

  • (cs) in reply to Akimoto
    Anonymous:
    robymus:

    Actually, i don't see the point in the sleep there. But if it is required (for any reason unknown to me), i don't think it is intented to ever end. So why not using:

    while true; do sleep 1; done; 

    (more expert shell-magic also possible :)

     

    Do you want to melt down the CPU?

    Why would this melt down the CPU? sleep command sleeps for a given number of seconds, so the CPU would be mostly idle.
  • (cs) in reply to sao
    sao:
    Anonymous:
    "The number of seconds since 1/1/70? WTF?"

    Actually, there are two things us Windows guys don't understand.

    1)  You count in seconds?  WTF?

    2)  You use 32 bits for time?  WTF?

    Windows guys, at least of the NT persuasion, use a 64-bit count of the number of 100nS ticks since 1/1/1601.

    We don't have no steenkin' 2038 bug.


    capcha: genius
    "Why, thanks!"



    The REAL WTF is that your happy being M$'s PlayThing(tm).


    Note to self: Looking forward to more of sao's intelligent, unbiased, thoughtful, original, and insightful posts.
  • (cs) in reply to Digitalbath
    Digitalbath:

    JBL:
    Anonymous:
    Got to love code that requires continued maintance

    Heck, if they upgrade the OS to 64-bit, then no problem.

    On the other hand, I'll be in my early 70's by then. I look forward to not receiving a Social Security check for a few years while the govt sorts it out on their 30-year-old servers.

    On the other other hand, that check will be worth about 85 cents anyway, yes?

    [and how long until someone manages to fit "none of us has a girlfriend anyway" in here?]

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>



    How about not assuming that everyone who reads this forum is male (and straight at that) to begin with?  That would solve all of your crazy problems.  ;)

    Well...not all....

  • just me - a tiny unix god (unregistered) in reply to Bus Raker
    Bus Raker:

    graywh:
    The REAL WTF is that no one actually read and/or understood the WTF which makes no sense whatsoever.  UNIX's sleep command sleeps for N seconds, not until there are X seconds left in the EPOCH.  WTF?  The startup script should have run for 1000000000 seconds from the time it was started, regardless of the date.

    Wow .. you are wrong, because if you look at the code behind the 'sleep' command (i think they keep 'em in the bin folder or something) you will see that a date/time variable is created to hold the end time, which will overflow during execution.

    You could test this by changing the system date (adding 999999990) while it is executing to see which is the case.  If it ends in 10 seconds....

    I really don't care though.




    The original poster was right, the real WTF is that nobody figured out that the explanation was nonsense.

    1. sleep 1000000000 does work. Thus "Time passed 2^31-10^9 that weekend" is irrelavent.
    2. The code behind sleep can be downloaded from http://directory.fsf.org/GNU/coreutils.html and shows that sleep is just a wrapper to the nanosleep() system call.
    3. However: the code which checks for overflow is so broken, that it is a WTF in itself. Check out xnanosleep.c yourself if you are somewhat capable.
    4. Additionally the overflow catch functionality fails as
    # define TIME_T_MAX TYPE_MAXIMUM (time_t)
    always returns -1.

    Now all you loosers too stupid to check 250 lines of C-code go back into your cubicles and go on producing more WTFs.
  • WHO WANTS TO KNOW? (unregistered) in reply to Foo

    I guess you never worked with computers before, huh?  You could have the most PERFECT program, and customers will STILL want things THEIR way, even if they are wierd and cumbersome.  One friend once asked me how I could have a job programming "After all, all the software must have already been written after the past 60 years!"!  Yeah, and one person supposedly said “We should close the Patent Office, because everything

    <NOBR>that could have been invented, has been invented.” </NOBR>

    that can be invented already has been".

    Steve

  • Shizzle (unregistered) in reply to Akimoto
    Anonymous:

    Anonymous:
    "There is no easy way to do "sleep for x seconds" other than to add x to the current time to determine the wakup time"

    huh?

    int main(int argc, char** argv) {
       time_t duration = (time_t) atol(argv[1]);
       time_t start = time(NULL);
       for(;;) {
         time_t now = time(NULL);
         if( (now - start) >= duration)
           return 0;
      }
    }

     

    HUH?

     

    Man! Stop and think a little

    (now - start) >= duration is equivalent to now  >= duration + start

    so you end up adding start time and duration.

    Regards



    Hey stupid, if you read my whole message you would see that was the solution I proposed, the WTF is you.
  • Shizzle (unregistered) in reply to Akimoto
    Akimoto:

    Anonymous:
    "There is no easy way to do "sleep for x seconds" other than to add x to the current time to determine the wakup time"

    huh?

    int main(int argc, char** argv) {
       time_t duration = (time_t) atol(argv[1]);
       time_t start = time(NULL);
       for(;;) {
         time_t now = time(NULL);
         if( (now - start) >= duration)
           return 0;
      }
    }

     

    HUH?

     

    Man! Stop and think a little

    (now - start) >= duration is equivalent to now  >= duration + start

    so you end up adding start time and duration.

    Regards



    I actually have to reply again, I went back and read my message to make sure that was the solution I proposed in it.  WTF, you didn't even read my whole message before you tell me to "think a little".  WOW, pathetic you are.
  • (cs) in reply to BlueRose
    BlueRose:
    Digitalbath:

    JBL:
    Anonymous:
    Got to love code that requires continued maintance

    Heck, if they upgrade the OS to 64-bit, then no problem.

    On the other hand, I'll be in my early 70's by then. I look forward to not receiving a Social Security check for a few years while the govt sorts it out on their 30-year-old servers.

    On the other other hand, that check will be worth about 85 cents anyway, yes?

    [and how long until someone manages to fit "none of us has a girlfriend anyway" in here?]

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>



    How about not assuming that everyone who reads this forum is male (and straight at that) to begin with?  That would solve all of your crazy problems.  ;)

    Well...not all....

    I was just trying to make a little joke for when last friday, when I started my post off with "female coworker," people said that was sexist.  I didn't think so because you would have been able to figure  out the gender of the person who I was referring to in the next sentence when i said "she."  Perhaps I am wrong, though.

  • same old song (unregistered)
    the Earth is flat
    man will never fly
    the atom is the smallest component in the universe - it can not be split
    don't worry about 4 digit years - it's too far off
    you can't go faster than the speed of sound
    man will never walk on the moon
    640K is enough for anyone
    the stock market will never hit 10000
    cell phones will never catch on - they're too big
    tech stocks won't tank (circa 2000)
    

    sigh - never say never

    captcha = captcha - very original ;)

  • (cs) in reply to Digitalbath
    Digitalbath:
    BlueRose:
    Digitalbath:

    JBL:

    [and how long until someone manages to fit "none of us has a girlfriend anyway" in here?]

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>



    How about not assuming that everyone who reads this forum is male (and straight at that) to begin with?  That would solve all of your crazy problems.  ;)

    Well...not all....

    I was just trying to make a little joke for when last friday, when I started my post off with "female coworker," people said that was sexist.  I didn't think so because you would have been able to figure  out the gender of the person who I was referring to in the next sentence when i said "she."  Perhaps I am wrong, though.



    Ah yes, I do remember reading that.  The additional adjective of "female" seemed redundant given that you had covered that information with the pronoun of "she".

    And my male coworker, he agrees with me.  ;)
  • Player42 (unregistered)

    Actually

    sleep 1000000000
    does work, but
    sleep 10000000000

    fails. The cool WTF is now that
    sleep 100000000000 until
    sleep 1000000000000000
    works again! Seems another WTF is the implemantaion of sleep...

    (oh, and the captcha asks for genius *smile*)

  • Player42 (unregistered) in reply to Player42
    Anonymous:
    Actually
    sleep 1000000000
    does work, but
    sleep 10000000000
    fails. The cool WTF is now that
    sleep 100000000000 until
    sleep 1000000000000000
    works again! Seems another WTF is the implemantaion of sleep...

    (oh, and the captcha asks for genius *smile*)



    From the README of the source code:

    Most of these programs have significant advantages over their Unix
    counterparts, such as greater speed, additional options, and fewer
    arbitrary limits.


    LOL

  • (cs) in reply to just me - a tiny unix god

    Anonymous:
    2. The code behind sleep can be downloaded from http://directory.fsf.org/GNU/coreutils.html and shows that sleep is just a wrapper to the nanosleep() system call.

    What makes you think the WTF used the GNU version of sleep?

  • Manwolf (unregistered) in reply to Unforgiven

    Who taught the first Teacher?  Hmm maybe he was self taught.

  • Tim (unregistered) in reply to Unforgiven
    Anonymous:
    The most stupid things I ever seen were done by very graduated idiots. Please dont attack self-taugh people, this has nothing to do with professional quality.


    But it does indeed deal with professional quality.  There are some amazing self-taught programmers and there are some very stupid programmers who have a degree.  As mentioned before, a self-taught programmer with 4 years of experience will be a better bet than a programmer straight out of school.  But it's my opinion, feel free to tell me what you think, that after a few years of experience out of school the degreed programmer will in general quickly surpass the self-taught programmer.
  • (cs) in reply to BlueRose
    BlueRose:
    Digitalbath:
    BlueRose:
    Digitalbath:

    JBL:

    [and how long until someone manages to fit "none of us has a girlfriend anyway" in here?]

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>



    How about not assuming that everyone who reads this forum is male (and straight at that) to begin with?  That would solve all of your crazy problems.  ;)

    Well...not all....

    I was just trying to make a little joke for when last friday, when I started my post off with "female coworker," people said that was sexist.  I didn't think so because you would have been able to figure  out the gender of the person who I was referring to in the next sentence when i said "she."  Perhaps I am wrong, though.



    Ah yes, I do remember reading that.  The additional adjective of "female" seemed redundant given that you had covered that information with the pronoun of "she".

    And my male coworker, he agrees with me.  ;)

    Redundant, yes.  Sexist...?  I still don't think so.  I did not make any sweeping generalizations about female programmers, I was sharing a story about one specific person, who happened to be female...and incompetent. 

  • Sonix (unregistered) in reply to just me - a tiny unix god
    Anonymous:
    The original poster was right, the real WTF is that nobody figured out that the explanation was nonsense.

    1. sleep 1000000000 does work. Thus "Time passed 2^31-10^9 that weekend" is irrelavent.
    2. The code behind sleep can be downloaded from http://directory.fsf.org/GNU/coreutils.html and shows that sleep is just a wrapper to the nanosleep() system call.
    3. However: the code which checks for overflow is so broken, that it is a WTF in itself. Check out xnanosleep.c yourself if you are somewhat capable.
    4. Additionally the overflow catch functionality fails as
    # define TIME_T_MAX TYPE_MAXIMUM (time_t)
    always returns -1.

    Now all you loosers too stupid to check 250 lines of C-code go back into your cubicles and go on producing more WTFs.


    4) If you read the define correctly, it will cast -1 to time_t which is an unsigned integer type (size depends on platform used). Since unsigned integers are modulo integers, -1 will wrap around to the maximum unsigned integer size. There is nothing wrong with the TYPE_MAXIMUM define.


  • (cs) in reply to just me - a tiny unix god
    Anonymous:


    Now all you loosers...


    Loosers of what?

    The hounds of war?

    Pigeons?

    Evidence of a need for kaopectate?

    Folks whose vocabulary does not extend to spanner or wrench?

    Inquiring minds want to know these things!
  • Syrion (unregistered) in reply to uber1024

    Anonymous:
    Satanicpuppy:
    the next common datasize up from 32 is 64, and 64 will last 584,942,417,355 years, which should be enough for anyone.


    One of my clients is a huge block of carbon-14, so it's not okay to them.

    I don't think it will cause any problem to your C14 client !

    First, 584,942,417,355 years is not the good number, because the 64bits are 2's complement signed, and negative numbers are millisecond before January the 1st, 1970, 00h00. So if ALL of negative number are assigned to the past (the worse case), 584,942,417,355 must be divided by 2 to split time before and after 01/01/1970 00:00:00.000

    Then, we have about 292 billions of years before and after 01/01/1970. The universe is about 15 billions years old : we are in the range. Since the the Sun's remaining lifetime is about 5 billions years, we are in the range for the future. In the case we escape the Solar System to avoid being fused in Sun's death, we'll have about 287 billions years to increase the "time counter" size.

    In conclusion : Carbon-14 will be happy to know it will be totaly desintegrated before the "e-end of time", and we are able to represent its birthdate.

  • (cs) in reply to BlueRose
    BlueRose:
    Digitalbath:
    BlueRose:
    Digitalbath:

    JBL:

    [and how long until someone manages to fit "none of us has a girlfriend anyway" in here?]

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>



    How about not assuming that everyone who reads this forum is male (and straight at that) to begin with?  That would solve all of your crazy problems.  ;)

    Well...not all....

    I was just trying to make a little joke for when last friday, when I started my post off with "female coworker," people said that was sexist.  I didn't think so because you would have been able to figure  out the gender of the person who I was referring to in the next sentence when i said "she."  Perhaps I am wrong, though.



    Ah yes, I do remember reading that.  The additional adjective of "female" seemed redundant given that you had covered that information with the pronoun of "she".

    And my male coworker, he agrees with me.  ;)

    Only because he wants to have sex with you...

  • home homine lupus est (unregistered) in reply to Syrion

    Another approach:

    start Oracle
    touch run_oracle_forever.lock
    run:
    sleep 200
    if exist run_oracle_forever goto run
    stop Oracle
    cat tadaaa.wav > /dev/audio

    removing the file "run_oracle_forever.lock" will stop oracle nicelly :D

    rm run_oracle_forever.lock

  • Player42 (unregistered) in reply to Cooper
    Cooper:
    Anonymous:


    Now all you loosers...


    Loosers of what?

    The hounds of war?

    Pigeons?

    Evidence of a need for kaopectate?

    Folks whose vocabulary does not extend to spanner or wrench?

    Inquiring minds want to know these things!


    What about: loosers of substantial boundary checking.

    Dare you to call me a loser! ;-) Thanks anyway.
  • Anonymous (unregistered) in reply to Unforgiven
    I've seen very stupid things done by graduate idiots, I've seen very smart things done graduates.  Almost uniformly, I've seen very stupid things done by non-graduated idiots.
     
    Maybe you guys are the exceptions.
  • Sleeper Code (unregistered) in reply to just me - a tiny unix god

    Anonymous:
    2. The code behind sleep can be downloaded from http://directory.fsf.org/GNU/coreutils.html and shows that sleep is just a wrapper to the nanosleep() system call.

    If there were such a thing as "the code behind sleep()," then either the GNU people would be in serious violation of UNIX System V copyrights, or else the UNIX people would be in serious breach of the GNU license.  I really don't think everyone might be using the same implementation of sleep().

  • Reed (unregistered) in reply to Akimoto
    Akimoto:

    Man! Stop and think a little

    (now - start) >= duration is equivalent to now  >= duration + start

    so you end up adding start time and duration.



    Mathematically but not computationally.

  • mathew (unregistered) in reply to silkio
    what he should've done is sleep -1 if the command supports it, or wait on some mutex/object that won't be released.

    No, what he should have done is written a proper /etc/init.d/oracle service start script, and symlinked it to /etc/rc5.d/S99oracle, so that when the server is rebooted the database starts up automatically.

    (Using start-stop-daemon or equivalent, if he wanted a separate PID file so the monitoring software could find the database and monitor it.)

    That way, any competent Unix admin will be able to correctly and cleanly start, stop or restart the database server.

  • Curious One (unregistered) in reply to nsimeonov

    ...not really, since the current time doesn't overflow yet, and the sleep_end in that example can't be the source of the original crash (as it would have done so on bootup).

     

     

  • (cs) in reply to Digitalbath
    Digitalbath:
    BlueRose:
    Digitalbath:

    I was just trying to make a little joke for when last friday, when I started my post off with "female coworker," people said that was sexist.  I didn't think so because you would have been able to figure  out the gender of the person who I was referring to in the next sentence when i said "she."  Perhaps I am wrong, though.



    Ah yes, I do remember reading that.  The additional adjective of "female" seemed redundant given that you had covered that information with the pronoun of "she".

    And my male coworker, he agrees with me.  ;)

    Redundant, yes.  Sexist...?  I still don't think so.  I did not make any sweeping generalizations about female programmers, I was sharing a story about one specific person, who happened to be female...and incompetent. 



    I didn't say it was sexist, only redundant.  And an unfortunate redundancy at that, which was why a few people pounced on it.

    Even if it had been, it was nowhere approaching some of the sexism I've seen posted here previously, so I don't know why you were pounced on and the others were not.  Altogether, very strange.
  • (cs) in reply to res2
    res2:
    BlueRose:
    Digitalbath:
    BlueRose:

    How about not assuming that everyone who reads this forum is male (and straight at that) to begin with?  That would solve all of your crazy problems.  ;)

    Well...not all....

    I was just trying to make a little joke for when last friday, when I started my post off with "female coworker," people said that was sexist.  I didn't think so because you would have been able to figure  out the gender of the person who I was referring to in the next sentence when i said "she."  Perhaps I am wrong, though.



    Ah yes, I do remember reading that.  The additional adjective of "female" seemed redundant given that you had covered that information with the pronoun of "she".

    And my male coworker, he agrees with me.  ;)

    Only because he wants to have sex with you...



    What can I say, I'm a popular gal.  ;)
  • (cs) in reply to Digitalbath
    Digitalbath:

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>

    Clearly, "girlfriend" and "boyfriend" are both sexist.  We should now all refer to them as "personfriends".  Actually, "friend" implies exclusivity, which is also verboten.  The new term shall be "personacquaintance".

    </OverflowingPCIsm>

  • bcat (unregistered) in reply to GalacticCowboy
    GalacticCowboy:
    Digitalbath:

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>

    Clearly, "girlfriend" and "boyfriend" are both sexist.  We should now all refer to them as "personfriends".  Actually, "friend" implies exclusivity, which is also verboten.  The new term shall be "personacquaintance".

    </OverflowingPCIsm>



    Personacquaintance is doubleplusgood. You are a goodthinker.
  • (cs) in reply to BlueRose
    BlueRose:
    Digitalbath:

    JBL:
    Anonymous:
    Got to love code that requires continued maintance

    Heck, if they upgrade the OS to 64-bit, then no problem.

    On the other hand, I'll be in my early 70's by then. I look forward to not receiving a Social Security check for a few years while the govt sorts it out on their 30-year-old servers.

    On the other other hand, that check will be worth about 85 cents anyway, yes?

    [and how long until someone manages to fit "none of us has a girlfriend anyway" in here?]

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>



    How about not assuming that everyone who reads this forum is male (and straight at that) to begin with?  That would solve all of your crazy problems.  ;)

    Well...not all....

    Maybe they are male but whether they are straight cannot be determined until after the waveform collapses. Kinda like the Schroedinger's Cat situation. As for male/female, I'd wager that the Steve Rule applies to this forum.

  • Player42 (unregistered) in reply to Sleeper Code
    Anonymous:

    Anonymous:
    2. The code behind sleep can be downloaded from http://directory.fsf.org/GNU/coreutils.html and shows that sleep is just a wrapper to the nanosleep() system call.

    If there were such a thing as "the code behind sleep()," then either the GNU people would be in serious violation of UNIX System V copyrights, or else the UNIX people would be in serious breach of the GNU license.  I really don't think everyone might be using the same implementation of sleep().



    I had answered (and quoted) to another post which read:
    Wow .. you are wrong, because if you look at the code behind the 'sleep' command (i think they keep 'em in the bin folder or something) you will see that a date/time variable is created to hold the end time, which will overflow during execution.

    However nanosleep() is a POSIX system call and will be most likely be used/wrapped in any modern implementation of sleep. And just by chance the GNU version does show the erratic behaviour as described in the WTF.
  • Player42 (unregistered) in reply to Sonix
    Anonymous:

    4) If you read the define correctly, it will cast -1 to time_t which is an unsigned integer type (size depends on platform used). Since unsigned integers are modulo integers, -1 will wrap around to the maximum unsigned integer size. There is nothing wrong with the TYPE_MAXIMUM define.




    Removing the if-statement around the overflow catch and thus simply setting  ts_sleep.tv_sec = -1 results in an error which essentially means that on amd64 time_t is not unsigned int.
  • (cs) in reply to GoatCheez
    GoatCheez:
    graywh:
    The REAL WTF is that no one actually read and/or understood the WTF which makes no sense whatsoever.  UNIX's sleep command sleeps for N seconds, not until there are X seconds left in the EPOCH.  WTF?  The startup script should have run for 1000000000 seconds from the time it was started, regardless of the date.


    I believe the explanation is something along the lines of when 1000000000 is added to the internal time, then the overflow occurs. The error didn't arise until currentdate+sleeptime>datatypesize.


    Thanks for the explanation.  The WTF post wasn't clear to those of those that have never looked at the source for sleep.  That's the real WTF.

    And to everyone that gave me a mean reply, take a chill pill.
  • Mig-O (unregistered)

    This reminds me of a report which i had to port from one of the biggest players to a view in my application, because the boss didn't like the "copyFromClipboard-insertInMDB-doStuff-copyToExcel-copyFromOtherExcelPageToMDB-generateReport"
    procedere. I thought: Hey, no problem, just lets look what an Oracle-Statement-Sniffer shows in the application, and import the data directly (instead of using the clipboard variant).

    My eyes where bleeding when i saw about 3000 single Selects that took about 20 Minutes to execute, from whichs data the application generated the report. It took me 3 days to replace this with some views (that worked similar, i didnt figure everything out), and let the hole thing run in 10 seconds.

    We learn: If we use ORMs, please choose one which supports native SQL-Querys. (Or just stay away from Gupta).

  • Loren Pechtel (unregistered) in reply to graywh
    graywh:
    The REAL WTF is that no one actually read and/or understood the WTF which makes no sense whatsoever.  UNIX's sleep command sleeps for N seconds, not until there are X seconds left in the EPOCH.  WTF?  The startup script should have run for 1000000000 seconds from the time it was started, regardless of the date.


    No.  The problem is that it was adding the seconds specified to the current time in order to get the stop time.  That calculation was overflowing.
  • (cs) in reply to Akimoto
    Anonymous:

    [Man! Stop and think a little

    (now - start) >= duration is equivalent to now  >= duration + start

    so you end up adding start time and duration.

    Regards

    Perhaps you need to stop and think a lot.

    Lets say now = 90

    start = 85

    duration = 20

    We can only hold two digit numbers.

    So now-start = 15, 15 is not >= 20.

    duration + start = 05, 90 >= 5.

    Therefor you statement is NOT correct. And hence a WTF is born.

  • Anonymous Coward (unregistered) in reply to OneFactor
    OneFactor:
    BlueRose:
    Digitalbath:

    JBL:
    Anonymous:
    Got to love code that requires continued maintance

    Heck, if they upgrade the OS to 64-bit, then no problem.

    On the other hand, I'll be in my early 70's by then. I look forward to not receiving a Social Security check for a few years while the govt sorts it out on their 30-year-old servers.

    On the other other hand, that check will be worth about 85 cents anyway, yes?

    [and how long until someone manages to fit "none of us has a girlfriend anyway" in here?]

    Stop it you crazy sexist.  How dare you refer to women as "girlfriends."  That singles them out as compared to "boyfriends."  Please use "significant other" from now on, or I will stick our my lower lip and pout.

    </OverflowingSarcasm>



    How about not assuming that everyone who reads this forum is male (and straight at that) to begin with?  That would solve all of your crazy problems.  ;)

    Well...not all....

    Maybe they are male but whether they are straight cannot be determined until after the waveform collapses. Kinda like the Schroedinger's Cat situation. As for male/female, I'd wager that the Steve Rule applies to this forum.



    People, you all are screwy.  The statement that "none of us has a girlfriend here anyway" is not sexist non-discriminatory.  It applies to all cases:


    straight males: no problem

    gay males: never have girlfriends, check

    straight females:  never have girlfriends, check

    gay females:  Gay females reading the forum are just as geeky and pathetic as the straight males.  Other girls are not interested, check.

    bi males:  See straight males.

    bi females:  See gay females

    Capice?

  • Snort (unregistered) in reply to Bus Raker

    "For 100000000 it will next crash 11/18/2034 2:13pm.:"

    Given that the application crashed because oracle exited, the application will crash  100000000/60/60/24 = 1157.4 days after it was started, so at least before the end of August 2009.



  • Snort (unregistered) in reply to home homine lupus est
    Anonymous:
    Another approach:

    start Oracle
    touch run_oracle_forever.lock
    run:
    sleep 200
    if exist run_oracle_forever goto run
    stop Oracle
    cat tadaaa.wav > /dev/audio

    removing the file "run_oracle_forever.lock" will stop oracle nicelly :D

    rm run_oracle_forever.lock



    Wow, now that must be the most complicated way to not having to type something arcane as 'stop oracle' to stop oracle.


  • Dwonis (unregistered) in reply to robymus
    robymus:

    Actually, i don't see the point in the sleep there. But if it is required (for any reason unknown to me), i don't think it is intented to ever end. So why not using:

    while true; do sleep 1; done; 

    (more expert shell-magic also possible :)



    I think I can rationalize the sleep command.

    Let's say you have the following script:
    #!/bin/sh
    trap "/bin/false" INT
    echo "start"
    sleep 100000000
    echo "stop"
    Now, if you start this script in a terminal, you will see "start".  Then, if you hit Ctrl-C, the sleep command will receive the SIGINT and exit, but the shell script will trap it and continue to execute the "stop" command.
  • (cs) in reply to Player42
    Anonymous:
    Actually
    sleep 1000000000
    does work, but
    sleep 10000000000
    fails. The cool WTF is now that
    sleep 100000000000 until
    sleep 1000000000000000
    works again! Seems another WTF is the implemantaion of sleep...

    (oh, and the captcha asks for genius *smile*)
    Interesting observation, and I can confirm it on Linux. However, sleep from GNU coreutils compiled on SFU (Interix) doesn't have this problem (but sleep that MS ships does - it says "sleep: 10000000000 is an invalid time value : Result too large").
  • (cs) in reply to Snort

    Anonymous:
    Anonymous:
    Another approach:

    start Oracle
    touch run_oracle_forever.lock
    run:
    sleep 200
    if exist run_oracle_forever goto run
    stop Oracle
    cat tadaaa.wav > /dev/audio

    removing the file "run_oracle_forever.lock" will stop oracle nicelly :D

    rm run_oracle_forever.lock



    Wow, now that must be the most complicated way to not having to type something arcane as 'stop oracle' to stop oracle.


     

    and not forgetting the zillion services that run around at app

     

    stop Oracle

    stop zillion services

  • Fist! (unregistered) in reply to Akimoto
    Anonymous:

    Anonymous:
    "There is no easy way to do "sleep for x seconds" other than to add x to the current time to determine the wakup time"

    huh?

    int main(int argc, char** argv) {
       time_t duration = (time_t) atol(argv[1]);
       time_t start = time(NULL);
       for(;;) {
         time_t now = time(NULL);
         if( (now - start) >= duration)
           return 0;
      }
    }

     

    HUH?

     

    Man! Stop and think a little

    (now - start) >= duration is equivalent to now  >= duration + start

    so you end up adding start time and duration.

    Regards


    I love these kind of WTF generating people.  They believe that mathematic principles always work when doing calculations on a computer.

    Lets take a little example... Mathematically speaking, the following expressions is always true:

       x + 1 > x , where x is an integer

    But guess what, this isn't always true in a computer program, if you don't believe me, run this Java code:

            int x = 0;
            while (x + 1 > x) { // should ***ALWAYS*** be true!
                x = x + 1;
            }
            System.out.println("Oh noes!  x+1 was not greather than x");

    How many more assumptions like this create real world WTFs?

    The idea behind testing "(now()-start)>duration" is that it never causes an overflow, unless of course, now() has overflowed, but then the sleep exiting prematurely is the least of your worries.

    Anyway, I do not know the actual implementation of all the varieties of sleep out there, or the exact one in this WTF, I am just pointing out the computational assumption that is probably behind this WTF  (in particular, the assumption that "now + duration > now", given duration is positive).

    Man! Think!
  • John Spencer (unregistered) in reply to tufty

    "So clue us in, oh Oracle gurus.  Does this come from ${ORACLE_ROOT}/bin/dbstart, or is it from elsewhere?"

    Not sure about guru, but I've worked as an Oracle DBA for 10 years.  I have never, ever needed nohups or &s to keep an instance running.  To start an Oracle instance on unix, you run sqlplus, the command line interface, and, connected as the sys user type startup.  Once you get a success message, you exut sqlplus and Oracle will run forever.  To stop an Oracle instance, in sqlplus connected as sys type shutdown, and it will stop.  Simple.

    The real WTF here is that the vendor wants to arbitrarily stop my database at some point in the future.

     

Leave a comment on “The Harbinger of the Epoch ”

Log In or post as a guest

Replying to comment #:

« Return to Article