Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. "Terminated in an unusual way", But Only in Europe

"Terminated in an unusual way", But Only in Europe

Scheduled Pinned Locked Moved Clever Code
helphtmlcomdebuggingannouncement
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike ONeill
    wrote on last edited by
    #1

    This one's not mine. I came across it at http://www.experts-exchange.com/Operating_Systems/WinXP/Q_22150503.html[^], but it seems to fit the "subtle bugs" category and I wanted to share it here. The developer had an internationally-deployed application which, apparently after a version upgrade, began to fail reliably with the message "The application has requested the Runtime to terminate it in an unusual way." However, the failure occurred only in Europe; the failure was not reproducible in the US. He tried linking with the "/MAP" linker option, and changing his WinMain code to install an exception handler that would allow him to see where the failure occurred. However, the failure was occurring before any of his code was executed, so it was failing even before the exception handler could be installed. After a false lead involving a possible flaw in the Microsoft assert() code, he eventually traced the problem to an initialization of a static variable (which of course is initialized by the CRT before any of his code is executed). Here is the developer's explanation of the problem and his solution:

    A Smart Developer wrote:

    What it turned out to be was the initialization of a static variable to what amounted to a negative time for anyone east of Greenwich: static CTime distantPast = CTime(1970, 1, 1, 0, 0, 0); Once I set my time zone to Berlin, the debugger found the problem in about 5 sec. The fix was very simple (2-Jan-1970 serves fine as the "distant past" for my purposes).

    His answer also suggests a good programming practice about initialization of date-related variables (i.e., January 2nd, not the 1st). Mike

    P G A 3 Replies Last reply
    0
    • M Mike ONeill

      This one's not mine. I came across it at http://www.experts-exchange.com/Operating_Systems/WinXP/Q_22150503.html[^], but it seems to fit the "subtle bugs" category and I wanted to share it here. The developer had an internationally-deployed application which, apparently after a version upgrade, began to fail reliably with the message "The application has requested the Runtime to terminate it in an unusual way." However, the failure occurred only in Europe; the failure was not reproducible in the US. He tried linking with the "/MAP" linker option, and changing his WinMain code to install an exception handler that would allow him to see where the failure occurred. However, the failure was occurring before any of his code was executed, so it was failing even before the exception handler could be installed. After a false lead involving a possible flaw in the Microsoft assert() code, he eventually traced the problem to an initialization of a static variable (which of course is initialized by the CRT before any of his code is executed). Here is the developer's explanation of the problem and his solution:

      A Smart Developer wrote:

      What it turned out to be was the initialization of a static variable to what amounted to a negative time for anyone east of Greenwich: static CTime distantPast = CTime(1970, 1, 1, 0, 0, 0); Once I set my time zone to Berlin, the debugger found the problem in about 5 sec. The fix was very simple (2-Jan-1970 serves fine as the "distant past" for my purposes).

      His answer also suggests a good programming practice about initialization of date-related variables (i.e., January 2nd, not the 1st). Mike

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      So it's not .net? And that's a work-around, not a fix. I think I'll try to get C# to do something like that. This might be a new kind of Friday quiz -- write a method that causes exception X. -- modified at 10:01 Saturday 10th February, 2007

      M 1 Reply Last reply
      0
      • P PIEBALDconsult

        So it's not .net? And that's a work-around, not a fix. I think I'll try to get C# to do something like that. This might be a new kind of Friday quiz -- write a method that causes exception X. -- modified at 10:01 Saturday 10th February, 2007

        M Offline
        M Offline
        Mike ONeill
        wrote on last edited by
        #3

        I have no idea what you're talking about, but good luck with that.

        1 Reply Last reply
        0
        • M Mike ONeill

          This one's not mine. I came across it at http://www.experts-exchange.com/Operating_Systems/WinXP/Q_22150503.html[^], but it seems to fit the "subtle bugs" category and I wanted to share it here. The developer had an internationally-deployed application which, apparently after a version upgrade, began to fail reliably with the message "The application has requested the Runtime to terminate it in an unusual way." However, the failure occurred only in Europe; the failure was not reproducible in the US. He tried linking with the "/MAP" linker option, and changing his WinMain code to install an exception handler that would allow him to see where the failure occurred. However, the failure was occurring before any of his code was executed, so it was failing even before the exception handler could be installed. After a false lead involving a possible flaw in the Microsoft assert() code, he eventually traced the problem to an initialization of a static variable (which of course is initialized by the CRT before any of his code is executed). Here is the developer's explanation of the problem and his solution:

          A Smart Developer wrote:

          What it turned out to be was the initialization of a static variable to what amounted to a negative time for anyone east of Greenwich: static CTime distantPast = CTime(1970, 1, 1, 0, 0, 0); Once I set my time zone to Berlin, the debugger found the problem in about 5 sec. The fix was very simple (2-Jan-1970 serves fine as the "distant past" for my purposes).

          His answer also suggests a good programming practice about initialization of date-related variables (i.e., January 2nd, not the 1st). Mike

          G Offline
          G Offline
          Graham Bradshaw
          wrote on last edited by
          #4

          Seems a bit wierd to me. The C runtime code includes error handling code such as: return (time_t)(-1); so clearly negative values relative to the epoch are expected.

          1 Reply Last reply
          0
          • M Mike ONeill

            This one's not mine. I came across it at http://www.experts-exchange.com/Operating_Systems/WinXP/Q_22150503.html[^], but it seems to fit the "subtle bugs" category and I wanted to share it here. The developer had an internationally-deployed application which, apparently after a version upgrade, began to fail reliably with the message "The application has requested the Runtime to terminate it in an unusual way." However, the failure occurred only in Europe; the failure was not reproducible in the US. He tried linking with the "/MAP" linker option, and changing his WinMain code to install an exception handler that would allow him to see where the failure occurred. However, the failure was occurring before any of his code was executed, so it was failing even before the exception handler could be installed. After a false lead involving a possible flaw in the Microsoft assert() code, he eventually traced the problem to an initialization of a static variable (which of course is initialized by the CRT before any of his code is executed). Here is the developer's explanation of the problem and his solution:

            A Smart Developer wrote:

            What it turned out to be was the initialization of a static variable to what amounted to a negative time for anyone east of Greenwich: static CTime distantPast = CTime(1970, 1, 1, 0, 0, 0); Once I set my time zone to Berlin, the debugger found the problem in about 5 sec. The fix was very simple (2-Jan-1970 serves fine as the "distant past" for my purposes).

            His answer also suggests a good programming practice about initialization of date-related variables (i.e., January 2nd, not the 1st). Mike

            A Offline
            A Offline
            Alex Cohn
            wrote on last edited by
            #5

            Small corretion, please. The problem was really in MS code for assert(). This assert() was not initialized correctly, and tried to use an unexisting stderr. Therefore, instead of displaying an assertion message, the application aborted with "Terminated in an unusual way". The problem was that the static variable initialization happened before he could use the patch suggested by Microsoft. Therefore the only way to fix it all was to find and cure the origin of assertion.

            P 1 Reply Last reply
            0
            • A Alex Cohn

              Small corretion, please. The problem was really in MS code for assert(). This assert() was not initialized correctly, and tried to use an unexisting stderr. Therefore, instead of displaying an assertion message, the application aborted with "Terminated in an unusual way". The problem was that the static variable initialization happened before he could use the patch suggested by Microsoft. Therefore the only way to fix it all was to find and cure the origin of assertion.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              Still just a work-around, right?

              L 1 Reply Last reply
              0
              • P PIEBALDconsult

                Still just a work-around, right?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                So?

                -------- Micrologic Networks, India

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups