[comp.databases] Bug in ORACLE's Pro*C ?

steinar@fdmetd.uucp (Steinar Overbeck Cook) (08/18/89)

ORACLE (Pro*C) SENDS SIGNAL 15 (SIGTERM) TO THE APPLICATION
---------------------------------------------------

Operating System: NCR UNIX 2.01 (which is System V.2 + a little V.3)
Machine         : NCR Tower/600
Oracle version  : 5.1.17.4

We have had a severe problem with an application written in Pro*C.
The problem being that SIGTERM was sent to our application at various
points of execution.

We have now tracked down the problem; when the length part of a host
variable is too large, the run-time libraries of Pro*C sends a SIGTERM.

The following fragment of code shows when it occurs:

The interesting points are marked with '<<<<<<<<<<<'.

         .
         .
         .
/* SQL stmt #7
    EXEC SQL BEGIN DECLARE SECTION;
*/
struct {
  unsigned short len;
  unsigned char arr[20];
  } get_version;
/*
        VARCHAR get_version[20];    
    EXEC SQL END DECLARE SECTION;
*/

/* SQL stmt #18
         EXEC SQL WHENEVER NOT FOUND CONTINUE;
         EXEC SQL SELECT kilde_versj_id, fysisk_versjon
            INTO :KV_kilde_versj_id:indicator_1,
                 :KV_fysisk_versjon:indicator_2
            FROM ops$uab.kilde_vers
            WHERE prosjekt_id = :P_prosjekt_id AND
                  subsystem_id = :S_subsystem_id AND
                  kilde_id = :K_kilde_id AND
                  kilde_versj_id = :get_version; <<<<<<<-----------
                            get_version.len is 233
                        which is 223 too large !
*/
sqlsca(&sqlca);
if ( !sqlusi[0] )
  {  /* OPEN SCOPE */
sq017.sq017T[0] = (unsigned short)10;
SQLTM[0] = (int)4;
sqlbs2(&sq017.sq017N, sq017.sq017V,
  sq017.sq017L, sq017.sq017T, sq017.sq017I,
  &SQLTM[0], &sqlusi[0]);
  }  /* CLOSE SCOPE */
sqlsch(&sqlusi[0]);
sqlscc(&sqlcun[4]);
sqltfl(&SQLTM[0], &SQLBT0);
if ( !SQLTM[0] )
  {  /* OPEN SCOPE */
SQLTM[0] = (int)16384;
sqlopn(&SQLTM[0], &SQLBT3, &sqlvsn);
SQLTM[0] = (int)143;
sqlosq(sq018, &SQLTM[0]);
  }  /* CLOSE SCOPE */
sq019.sq019V[0] = (unsigned char *)&P_prosjekt_id.len;
sq019.sq019L[0] = (unsigned int)13;
sq019.sq019T[0] = (unsigned short)9;
sq019.sq019I[0] = (unsigned short *)0;
sq019.sq019V[1] = (unsigned char *)&S_subsystem_id.len;
sq019.sq019L[1] = (unsigned int)13;
sq019.sq019T[1] = (unsigned short)9;
sq019.sq019I[1] = (unsigned short *)0;
sq019.sq019V[2] = (unsigned char *)&K_kilde_id.len;
sq019.sq019L[2] = (unsigned int)17;
sq019.sq019T[2] = (unsigned short)9;
sq019.sq019I[2] = (unsigned short *)0;
sq019.sq019V[3] = (unsigned char *)&get_version.len;
sq019.sq019L[3] = (unsigned int)22;
sq019.sq019T[3] = (unsigned short)9;
sq019.sq019I[3] = (unsigned short *)0;
sqlab2(&sq019.sq019N, sq019.sq019V,
  sq019.sq019L, sq019.sq019T, sq019.sq019I);
SQLTM[0] = (int)1;
sqlexe(&SQLTM[0]);  <<<<<<========= THIS IS WHERE IT BLOWS UP !!!!!
sq020.sq020V[0] = (unsigned char *)&KV_kilde_versj_id.len;
sq020.sq020L[0] = (unsigned int)13;
sq020.sq020T[0] = (unsigned short)9;
sq020.sq020I[0] = (unsigned short *)&indicator_1;
sq020.sq020V[1] = (unsigned char *)&KV_fysisk_versjon.len;
sq020.sq020L[1] = (unsigned int)13;
sq020.sq020T[1] = (unsigned short)9;
sq020.sq020I[1] = (unsigned short *)&indicator_2;
sqlad2(&sq020.sq020N, sq020.sq020V,
  sq020.sq020L, sq020.sq020T, sq020.sq020I);
SQLTM[0] = (int)1;
SQLTM[1] = (int)0;
sqlfch(&SQLTM[0], &SQLTM[1]);
SQLTM[0] = (int)1;
SQLTM[1] = (int)1;
sqlfch(&SQLTM[0], &SQLTM[1]);
         .
         .
         .
         .

A look at the stack, reveals the following :

    call%(168792,173064,14672980)
    osnpgetmsg(168792,1,165204)
    osnpgetdatmsg(168792,173064,0)
    osnprc(165204,0,14673198)
    ttcdrv(14673184,0,168792)
    osnwat(165204,0,68360)
    upirtr(165148,4,14676024)
    upiexn(165148,7,1)
    sqlexe(156140,796226418,794911587)
    uab_get_file(uabf=0x2b40c,getmode=292)   [uabget.c:1465]
    uabsp_main(uabf_block=0x2b40c)   [uabsp.c:953]
    main(argc=2,argv=0xdffd50,14679388)   [uabmain.c:386]


In my humble opinion, I do think that ORACLE should document the fact
that a SIGTERM is sent when ORACLE gets confused about lengths !
-- 
Steinar Overbeck Cook, Fellesdata a.s, P.O. Box 248, 0212 OSLO 2, NORWAY
Phone : +47 2 52 80 80                            Fax   : +47 2 52 85 10
E-mail : ...!mcvax!ndosl!fdmetd!steinar  or       steinar@fdmetd.uucp
<The opinions expressed, if any, do not represent Fellesdata a.s>