Consultor Eletrônico



Kbase P130198: 4GL/ABL: Error (40) repeatedly calling a PERSISTENT procedure that defines any TEMP-TABLE.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/12/2009
Status: Verified

SYMPTOM(s):

SYSTEM ERROR: Attempt to define too many indexes. (40)

Running a program that uses static TEMP-TABLEs.

4GL/ABL: Error (40) repeatedly calling a PERSISTENT procedure that defines any TEMP-TABLE.

It does not matter whether the TEMP-TABLE is defined with or without the NO-UNDO option.

The TEMP-TABLE DBI storage file keeps growing until the SYSTEM ERROR: Attempt to define too many indexes. (40) occurs and the client crashes.

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
All Supported Operating Systems

CAUSE:

If a procedure repeatedly RUN PERSISTENT a second procedure that defines one or more UNDO or NO-UNDO TEMP-TABLEs, then the SYSTEM ERROR: Attempt to define too many indexes. (40) will be generated unless the session ends before the 32K maximum number of indexes allowed for the TEMP-TABLE database is exceeded. This is because Progress creates a new copy with each instance of the PERSISTENT procedure and that copy remains in storage unless the session ends or the PERSISTENT procedure that created it is deleted.

FIX:

Ensure that only one copy of the TEMP-TABLE defining PERSISTENT procedure is run by checking the validity of its handle before running it. For example:
IF NOT VALID-HANDLE(hProcHandle) THEN
RUN CreateTempTable.p PERSISTENT SET hProcHandle.
Alternatively, ensure that the PERSISTENT procedure is destroyed before returning to the calling procedure by adding a statement like:
IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
at the end of the called PERSISTENT procedure.
It is better programming practice to do both.