Problem with recursive SPL procedure
Posted in 2005
First: this is IDS 7.31.UD7, running on SCO 5.0.6.
One of my developers had a problem that was absolutely perfect for
recursion. He wrote the following SPL procedure:
CREATE PROCEDURE get_cvx_kids (p_id INTEGER)DEFINE v_id INTEGER;
DEFINE v_id2 INTEGER;
FOREACH SELECT loc_id INTO v_id FROM 'dba'.location_msh WHERE parent_id
= p_id
IF v_id IS NOT NULL THEN EXECUTE PROCEDURE get_cvx_kids (v_id) ;
END IF;
END FOREACH
insert into tmp_id values (p_id);END PROCEDURE
;
The tmp_id table is a non-logged temp table with one integer field. He
tells me it works fine if he runs it with a parameter that doesn't have
a large number of results. When he ran it with the root location, where
the results should be every row, the instance crashed (Assert Failure:
No Exception Handler). The location_msh table has 7732 rows in it. When
they were running this there was no index on parent_id. This happened on
two different servers, though with the same data on both.
He said that to work around this he can unroll the recursion in a series
of nested foreach loops, because there's a limit to the depth this can
go, but that's pretty ugly. I'm wondering if anyone has seen this sort
of behavior, and whether it's something we did, or a problem with the
engine, etc.
The error from online.log:
17:47:22 Assert Failed: No Exception Handler
17:47:22 Informix Dynamic Server Version 7.31.UD7
17:47:22 Who: Session(232623, oci@c0a80274, 2276, 722003392)
Thread(496060, sqlexec, 2b068e8c, 3)
File: mtex.c Line: 471
17:47:22 Results: Exception Caught. Type: MT_EX_OS, Context: mem
17:47:22 Action: Please notify Informix Technical Support.
17:47:26 See Also: /tmp/af.95a41589
17:47:26 mtex.c, line 471, thread 496060, proc id 1887, No Exception
Handler.
17:47:26 PANIC: Attempting to bring system down
Any help would be appreciated.
---------------------------------
Douglas Conrey
Production Database Administrator
OCI
Cheyenne, WY
sending to informix-list