I stumbled across this bug trying to convert stems returned by rexxsql to collections. It seems to be related to creating objects while doing over a stem.
I have attached test.rex which demonstrates the problem.
It will not occur if any of the following are true:
1) change .directory~new() to anything static (i.e. 'test' or 1)
2) change the do x over stem. to do x = 1 to random(min,max)
3) if the stem is the same each time.
so it seems to be a very specific scenario:
A large stem is created, the stem is do over'ed, an object is created for each iteration of the do over. This procedure is repeated several times.
(the object doesn't even have to be assigned to anything to cause the issue)
Once the conditions are met the time required to complete the procedure will fluctuate between .5 seconds and 120 seconds. The example document uses a subroutine, procedure and routine without any measurable difference.