Problem Description

This page helps investigating any oracle error during saving step for a given AMT analyzer.

Example of errors for Oracle

Comparing objects on server . . .
 SQL Error: ORA-01427: single-row subquery returns more than one row
 SQL Error: ORA-06512: a "KB.AMT_P_FILL_OBJ", ligne 44.
 SQL Error: ORA-06512: a "KB.AMT_P_SPLIT_FILL", ligne 40.
 SQL Error: ORA-06512: a "KB.AMT_P_SPLIT_IN", ligne 18.
 SQL Error: ORA-06512: a "KB.CACHE_PROCESSID", ligne 57.
 SQL Error: ORA-06512: a ligne 1 (Severity 1, Msg No 1427).
Procedure call failed: ?KB.CACHE_PROCESSID,I_IDSESSION,I_IDUSRPRO

Comparing objects on server . . .
 Comparison completed.
 Merging objects on server . . .
 SQL Error: ORA-20000: AMT_F_MAJ_KB_PRJ:ObjPro(isInSourceLink):Duplicate data found
 SQL Error: ORA-06512: à "KB701.AMT_F_MAJ_KB_PRJ", ligne 143
 SQL Error: ORA-06512: à "KB701.AMT_F_MAJ_KB", ligne 17
 SQL Error: ORA-06512: à "KB701.CACHE_FLUSHDATA", ligne 35
 SQL Error: ORA-06512: à ligne 1 (Severity 1, Msg No 20000)
 Procedure call failed: ?KB701.CACHE_FLUSHDATA,I_IDSESSION

Example of errors for SQL Server

SQL error cannot insert duplicate key row in object 'dbo.ObjInf' with unique index 'PK_ObjInf'

AMT Analyzers are : J2EE analyzer, C/CPP analyzer, Universal Analyzer, New DotNet Analyzer, ABAP analyzer, New PL\SQL analyzer 

Applicable in CAST Version
Release
Yes/No
8.3.x(tick)
8.2.x(tick)
8.1.x(tick)
8.0.x(tick)
7.3.x(tick)
Action Plan
  1. Detect duplicated objects on the KB
    1. Run these queries on the KB:s

      SELECT IDNAM FROM OBJECTS group by IDNAM having count\(*) > 1
      SELECT IDNAM, FULLNAME, OBJTYP FROM OBJECTS o join OBJFULNAM f on f.IDOBJ = o.IDKEY where IDNAM in (SELECT IDNAM FROM OBJECTS group by IDNAM having count\(*) > 1)

      If queries return one or more rows,  this means that some duplicated objects are detected on this KB and we can conclude that Oracle error raised during saving step is related to these objects

  2. If any duplicated objects  can be detected
    1. Counter issue

      This step is possible only if you can identify source code file of objects generating error.

      Example1
      Here the list of object generating errors
      J:\SOURCES\Revision\customer\appname\module_486997.ABAP/ABAP/MACRO/DEL_TAB_A
      J:\SOURCES\Revision\customer\appname\module_486997.ABAP/ABAP/MACRO/DEL_TAB_A_P

      Here you see that objects belonging to the file 'module_486997.ABAP'

      Example2
      Here the list of object generating errors
      C_NS.PEP.C_NS.Common.C_FctD.operator <<(658513529)<:std::basic_ostream(char):&>
      C_NS.PEP.C_NS.Data.C_FctD.prosXMLformat(658513529)<:void:>
      C_NS.boost.C_NS.posix_time.C_Cl.millisec_posix_time_system_config.C_Mem.tick_per_second.C_Fi

      In this case we cannot identify the source code file generating error just with object name.
      However we can do this with enlighten

      1. put object in the view
      2. Click on F12 to get object properties : see source code file.

      We can counter issue as follows

      1. removing the file from analyzed code source
      2. Drop job result and restart analysis
    2. Transmit to the Production team in charge of the analyzer

  3. If no duplicated objects  can be detected
    1. Get customer's input
      • Analyzed code source
      • Analysis log file 
      • If customer is using CAST-MS to create and run analysis job : ask for the pmx file
      • If customer is using Analysis manager to create and run analysis job : ask for job export
    2. Reproduce issue
      1. In this case it's very recommanded to create a dedicated KB for reproduction
      2. AMT Saving debug mode
      3. Use CAST-MS to create and run analysis job
          1. create a managment base
          2. update customer pmx file with code source path folders
          3. connect with CAST-MS to the managment base
          4. import the updated pmx file
          5. add the created as analysis service
          6. Synchronize KB and run analysis

        If customer refuses to provide code source of if you cannot reproduce issue in your end, you can ask customer to 

        1. AMT Saving debug mode.  
        2.  Run the analysis again.
        3. Provide you with dump of this KB with this new analysis
    3. Get objects generating error
      1. Get the number of objects with errors

        1. Run following query on the knowledge base used for reproduction (See the conditions in the Reproduce issue)

          select '1' as "Id", 'Number of duplicated GUID in IN_OBJECTS table' as Description,count(1) as "FailedLines" from (select NAME_ID from IN_OBJECTS group by NAME_ID
          having count(1)>1) t
          union all
          select '2' as "Id", 'Number of objects with OBJECT_TYPE_ID not defined' as Description, count(1) as "FailedLines" from IN_OBJECTS where not exists (select 1 from Typ where IdTyp = IN_OBJECTS.OBJECT_TYPE_ID)
          union all
          select '3' as "Id", 'Number of objects not attached to a project' as Description,count(1) as "FailedLines"
          from IN_OBJECTS o
          where
            not exists (select 1 from IN_LINKS l where SOURCE_ID = o.OBJECT_ID and l.LINK_TYPE_ID = 1054)
          union all
          select '4' as "Id", 'Number of objects used as projects but not declared CAST_KBProject' as Description, count(1)  as "FailedLines" from IN_OBJECTS where OBJECT_ID in (
          select distinct l.TARGET_ID/*, tc.IdCatParent, o.OBJECT_TYPE_ID*/ from (IN_LINKS l join IN_OBJECTS o on (TARGET_ID = OBJECT_ID and LINK_TYPE_ID = 1054))
                                                             left outer join (TypCat tc join Cat c on (c.IdCat = tc.IdCatParent and c.CatNam = 'CAST_KBProject'))
                                                                           on (tc.IdTyp = o.OBJECT_TYPE_ID)
          where
            c.IdCat is null)
          union all
          select '5' as "Id", 'Number of projects not attached to himself(lnkTyp 1054)' as Description, count(1)  as "FailedLines" from (select distinct TARGET_ID from (IN_LINKS l join IN_OBJECTS o on (TARGET_ID = OBJECT_ID and LINK_TYPE_ID = 1054))) prj
                      left outer join IN_LINKS l on (l.TARGET_ID = prj.TARGET_ID and l.SOURCE_ID = prj.TARGET_ID and LINK_TYPE_ID = 1054)
          where l.LINK_ID is null
          union all
          select '6' as "Id", 'Number of objects without name or fullname' as Description, count(1)  as "FailedLines" from IN_OBJECTS o left join IN_CHAR_PROPERTIES p1 on (o.OBJECT_ID = p1.OBJECT_ID and p1.PROPERTY_TYPE_ID = 125)
                                     left join IN_CHAR_PROPERTIES p2 on (o.OBJECT_ID = p2.OBJECT_ID and p2.PROPERTY_TYPE_ID = 3)
          where p1.OBJECT_ID is null
          or p2.OBJECT_ID is null
          union all
          select '7' as "Id", 'Number of links using objects not in IN_OBJECTS' as Description, count(1)  as "FailedLines"
          from IN_LINKS l left join IN_OBJECTS o1 on (l.SOURCE_ID = o1.OBJECT_ID and SOURCE_KIND ='E' )
                          left join IN_OBJECTS o2 on (l.TARGET_ID = o2.OBJECT_ID and TARGET_KIND ='E')
          where o1.OBJECT_ID is null
          or o2.OBJECT_ID is null
          union all
          select '8' as "Id", 'Object not attached to a source(isInSourceLink)' as Description, count(1)  as "FailedLines"
          from IN_OBJECTS o1 left join IN_LINKS l on (l.SOURCE_ID = o1.OBJECT_ID and SOURCE_KIND ='E' and l.LINK_TYPE_ID = 2671)
          where
            l.SOURCE_ID is null
          union all
          select '9' as "Id", 'Object with CRC should be attached to himself with (isInSourceLink)' as Description, count(1)  as "FailedLines"
          from IN_INT_PROPERTIES p join IN_OBJECTS o on (o.OBJECT_ID = p.OBJECT_ID and PROPERTY_TYPE_ID = 106)
                                              left join IN_LINKS l on (l.SOURCE_ID = o.OBJECT_ID and l.LINK_TYPE_ID = 2671 and l.SOURCE_ID = o.OBJECT_ID )
          where l.SOURCE_ID is null
          union all
          select '10' as "Id", 'Links with incorrect project attachment' as Description, count(1) as "FailedLines"
          from IN_LINKS l left join IN_OBJECTS o on (o.OBJECT_ID = l.PROJECT_ID)
          where PROJECT_KIND ='E'
          and LINK_TYPE_ID not in (1032,1054,1056,2671)
          and o.OBJECT_ID is null
          union all
          select   '11'                                        as "Id"       ,
                   'Duplicate links for attachment to project' as Description,
                   count(1)                                    as "FailedLines"
          from     (select 1 from IN_LINKS
                      where    LINK_TYPE_ID   = 1054
                      and      TARGET_KIND ='E'
                      and      PROJECT_KIND ='E'
                      group by SOURCE_ID,
                               TARGET_ID
                      having   count(1) > 1) t
          order by 1
          

          The query result is like this one

          Id

          DESCRIPTION

          FailedLines

          1

          Number of duplicated GUID in IN_OBJECTS table

          10

          10

          Links with incorrect project attachment 

          0

          11

          Duplicate links for attachment to project

          0

          2

          Number of objects with OBJECT_TYPE_ID not defined

          0

          3

          Number of objects not attached to a project

          0

          4

          Number of objects used as projects but not declared CAST_KBProject

          0

          5

          Number of projects not attached to himself(lnkTyp 1054)

          0

          6

          Number of objects without name or fullname

          0

          7

          Number of links using objects not in IN_OBJECTS

          0

          8

          Object not attached to a source(isInSourceLink)

          0

          9

          Object with CRC should be attached to himself with (isInSourceLink)

          0

          Here we can see for example that Number of duplicated GUID in IN_OBJECTS table=10

        2. Get the list of these objects using this query

          select NAME_ID from IN_OBJECTS group by NAME_ID
          having count(1)>1)

          or this one

          select o.* from (select NAME_ID from SAV_IN_OBJECTS_1 group by NAME_ID
          having count(1)>1) t, SAV_IN_OBJECTS_1 o
          where o.NAME_ID = t.NAME_ID
          order by o.NAME_ID 
      2. Get the files containing objects generating a duplication for J2EE

        1. The following sql*plus script provides a list of files that can be removed in order to suppress the GUID duplication that can be generated with generic class instantiation (usually with implicit instantiations)

          ---------------------------------------------------------------------------------------------------
          -- Script providing the list of Java files which call generic object  with duplicated GUID
          ---------------------------------------------------------------------------------------------------
          
          ---------------------------------------------------------------------------------------------------
          -- Create a temp table containing all the duplicated guid for instanciated java objects
          create table TMP_DUPL_GUID as
            select IdNam
              from Objects
              where ObjTyp in (975, 976, 977, 978)
              group by IdNam
              having count(1) > 1;
          /
          ---------------------------------------------------------------------------------------------------
          -- Create a temp table containing all the duplicated guid with the number of project using them
          create table TMP_DUPL_NB_USE as
            select dup.IdNam, b.IdCle as IdCle, count(distinct b.IdPro) as NbPro
              from Objects o, Acc b, TMP_DUPL_GUID dup
              where o.IdNam = dup.IdNam
                and b.IdCle = o.IdKey
              group by  dup.IdNam, b.IdCle;
          /
          ---------------------------------------------------------------------------------------------------
          -- Select all the files to be removed from analysis which containing a call to a duplicated GUID
          select distinct rp.path from Acc ac, ObjFilRef ofr, RefPath rp, TMP_DUPL_NB_USE nbUse2
            where ac.idcle = nbUse2.IdCle
              and  ac.idcle not in
                                   (select NbUse.IdCle
                                      from TMP_DUPL_NB_USE NbUse, (select IdNam, max(NbPro) as MaxNbPro from TMP_DUPL_NB_USE group by IdNam) MaxUse
                                      where Nbuse.idnam = MaxUse.idNam
                                        and Nbuse.nbpro = MaxUse.MaxNbPro
                                   )
              and ofr.idobj = ac.idclr
              and rp.idfilref = ofr.idfilref;
          /
          ---------------------------------------------------------------------------------------------------
          -- Drop the temp tables
          drop table TMP_DUPL_NB_USE;
          /
          drop table TMP_DUPL_GUID;
          /
          ---------------------------------------------------------------------------------------------------
          exit;
          
    4. Counter issue

      This step is possible only if you can identify source code file of objects generating error.

      Example1
      Here the list of object generating errors
      J:\SOURCES\Revision\customer\appname\module_486997.ABAP/ABAP/MACRO/DEL_TAB_A
      J:\SOURCES\Revision\customer\appname\module_486997.ABAP/ABAP/MACRO/DEL_TAB_A_P

      Here you see that objects belonging to the file 'module_486997.ABAP'

      Example2
      Here the list of object generating errors
      C_NS.PEP.C_NS.Common.C_FctD.operator <<(658513529)<:std::basic_ostream(char):&>
      C_NS.PEP.C_NS.Data.C_FctD.prosXMLformat(658513529)<:void:>
      C_NS.boost.C_NS.posix_time.C_Cl.millisec_posix_time_system_config.C_Mem.tick_per_second.C_Fi

      In this case we cannot identify the source code file generating error just with object name.
      However we can do this with enlighten

      1. put object in the view
      2. Click on F12 to get object properties : see source code file.

      We can counter issue as follows

      1. removing the file from analyzed code source
      2. Drop job result and restart analysis
    5. Run the attached Fix.sql in the Local base. The issue was with several entries in temporary table AMT_LINK for the same EXTERNAL_ID.This is not forbidden at this stage of the computation, but procedure AMT_P_DIFF_POS was querying as if it were (expecting only one result).So the attached query would modify procedures AMT_P_DIFF_POS and AMT_P_FILL_PROPC
    6. Transmit to the Production team in charge of the analyzer

Relevant input

  1. The connection string to the KB used for reproduction
  2. Code source for reproduction
  3. Analysis log file
  4. result of the queries above
Notes

 

Related Pages