3 Replies Latest reply: Sep 2, 2009 8:38 AM by Mark Williams-Oracle RSS

    proc "debug assertion failed!"

    superdba
      hi,
      i m working on oracle 9i on windows ,when i run a proc then i get these error at end of proc, tell y m i getting these error

      debug assertion failed!

      program:preptty.exe
      file:fprintf.c
      line:56

      expression:str !=null

      for information on how your program can cause an assertion
      failure,see the visual c++ documentation on asserts.
      (please retry to debug the application)

      and then

      APPLICATION ERROR

      this instruction at "0x0040809c" referenced memory at "0x00000010".
      the memory could not be "read".
      click on OK to terminate the program
      click on CANCEL to debug the program



      now i came to know that in my proc where i used lots of time printf command

      fprintf(ptr,"Calculation Terminated Sucessfully!!!\n");

      there i m having this problem but when i coment these printf commands i didnt get this error
      id idnt know why this error coming now and how to resolve it ?

      thanks
        • 1. Re: proc "debug assertion failed!"
          Mark Williams-Oracle
          Hi,

          Does "proc" mean "Pro*C"? Or something else?

          The assertion is saying that a format control string passed to fprintf was NULL - is the assertion raised on this code?

          fprintf(ptr,"Calculation Terminated Sucessfully!!!\n");

          Or is it raised when you have a variable or format specifications in the control string?

          Regards,

          Mark
          • 2. Re: proc "debug assertion failed!"
            superdba
            ys proc means pro*c . i get this error only when using fprintf command when i remove this it works fine. and my proc had been working fine before but i have been getting this error sudenlly.
            so i dont think its related to my code or application . i guess its os related problem.
            but odnt know how to resolve it ?

            thanks
            • 3. Re: proc "debug assertion failed!"
              Mark Williams-Oracle
              Why do you suspect an operating system issue?

              I'm guessing you are on Windows. If you look at fprintf.c and line 55/56 you should see:

              VALIDATERETURN( (str != NULL), EINVAL, -1);
              VALIDATERETURN( (format != NULL), EINVAL, -1);

              These are the checks for the file pointer and the format control string and if either is NULL an assertion is raised.

              Here's an easy way to see this:

              {noformat}
              /*
               * this will cause an assertion
               */
              fprintf(NULL, "bad!");
              {noformat}


              {noformat}
              /*
               * this will cause an assertion
               */
              fprintf(fp, NULL);
              {noformat}

              Have you confirmed that the assertion is raised from:

              fprintf(ptr,"Calculation Terminated Sucessfully!!!\n");

              Since you have "expression:str !=null" that is an indication that the file pointer is NULL. Perhaps you are not checking the file pointer before using it and it is NULL?

              Regards,

              Mark