firebird
firebird copied to clipboard
Increase limit for "Too many concurrent executions of the same request"
Good afternoon I have a procedure that needs to be recursively executed many times. This is not an endless loop. Is it possible to disable protection or increase the limit on the number of executions for "Too many concurrent executions of the same request"?
No without deep engine modification.
But as a rule of thumb every recursion can be turned into iteration. You should consider this way. Perhaps using a temporary table to collect results.
I need to go up the tree of people from one person to a higher level. And there can be more than 1000 such attachments. Even if I collect record IDs into a temporary table, I will still have to face this error. Or is there some other mechanism?
Did you try to use WHILE loop?
I'm using a procedure that receives an ID of record as an input parameter. If there is a record at a higher level, then I call the same procedure inside the procedure with the identifier of the record that is higher.
Thanks! I will try to use WHILE loop.
This trivial task don't need recursion:
WHILE (ID IS NOT NULL) DO
BEGIN
RESULT = ID;
SELECT BOSS FROM PEOPLE WHERE ID=:ID INTO :ID;
END
Thanks a lot!
That limit serves two goals: (1) prevents infinite (or finite but risky due to possible stack overflow) recursion and (2) prevents resource leaks (query is not released but executed again and again - we had this issue for some system requests in the past -- due to logic bugs). Now it strikes back for real user queries too -- due to compiled statement cache. Perhaps we need to distinguish between these cases and maybe have different limits for them.
Isn't it just a matter of resetting of the counter during retrieval from the cache?
In the case reported, I guess by some reason in the user code there are many active requests.
Can you show the code involved to cause the error @AkulovNikolay ?
I am gettinng the same error message. Our C# Code uses the classes from '''FirebirdSql.Data.FirebirdClient''' to call a procedure for generating primary keys many times within one transaction to add a lot of rows to a table. So now I wonder how the "concurrent executions of the same request" are counted. Is this counted within one transaction or is there some other "concurrent execution" going on that I do not understand?
It is not about transactions. It is about many active instances of the same requests withing same attachment. Make sure you close cursor (release statement? I don't use C# and may be wrong in details) after use. Consider to ask in https://groups.google.com/g/firebird-net-provider and show your code there.
It is not about transactions. It is about many active instances of the same requests withing same attachment. Make sure you close cursor (release statement? I don't use C# and may be wrong in details) after use. Consider to ask in https://groups.google.com/g/firebird-net-provider and show your code there.
Thanks for the reply. I am not deep enough into Firebird or the Firebird-Net-Provider to know when a request is activated and deactivated. As a workaround I changed our code that it does not ran as many of the procedure calls which fixed the problem for now. I try to find the strength to bring the problem up in the Firebird-Net-Provider group.